aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-12 17:50:48 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-12 17:50:48 +0200
commit4d974f0d44c9f6398fc9d46215a4572329f1fbd5 (patch)
treea65138f0993e025ff966bb44bfacb2835fe54859 /test
parentREADME: minor update (diff)
downloadcgitize-4d974f0d44c9f6398fc9d46215a4572329f1fbd5.tar.gz
cgitize-4d974f0d44c9f6398fc9d46215a4572329f1fbd5.zip
test: no need to pre-configure git, remove some warnings
Diffstat (limited to 'test')
-rw-r--r--test/integration/docker/git_server/Dockerfile1
-rwxr-xr-xtest/integration/local/test.sh29
2 files changed, 21 insertions, 9 deletions
diff --git a/test/integration/docker/git_server/Dockerfile b/test/integration/docker/git_server/Dockerfile
index a33bce3..55b3362 100644
--- a/test/integration/docker/git_server/Dockerfile
+++ b/test/integration/docker/git_server/Dockerfile
@@ -4,6 +4,7 @@ RUN apk add -q --no-cache bash git openssh-server tini && \
echo 'root:root' | chpasswd && \
git config --global user.name 'John Doe' && \
git config --global user.email 'John.Doe@example.com' && \
+ git config --global init.defaultBranch main && \
sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
WORKDIR /root
diff --git a/test/integration/local/test.sh b/test/integration/local/test.sh
index 05de5ac..96ab2c5 100755
--- a/test/integration/local/test.sh
+++ b/test/integration/local/test.sh
@@ -12,6 +12,17 @@ readonly etc_dir="$script_dir/etc"
readonly cgitize_toml_path="$etc_dir/cgitize.toml"
readonly output_dir="$script_dir/output"
+readonly git_name='John Doe'
+readonly git_email='John.Doe@example.com'
+readonly git_default_branch=main
+
+_git() {
+ git -c "user.name=$git_name" \
+ -c "user.email=$git_email" \
+ -c "init.defaultBranch=$git_default_branch" \
+ "$@"
+}
+
success() {
echo
echo ----------------------------------------------------------------------
@@ -42,13 +53,13 @@ setup_upstream_repo() {
upstream_repo_dir="$( mktemp -d )"
pushd -- "$upstream_repo_dir" > /dev/null
- git init
+ _git init
echo '1' > 1.txt
- git add .
- git commit -m 'first commit'
+ _git add .
+ _git commit -m 'first commit'
echo '2' > 2.txt
- git add .
- git commit -m 'second commit'
+ _git add .
+ _git commit -m 'second commit'
popd > /dev/null
}
@@ -62,8 +73,8 @@ add_commits() {
pushd -- "$upstream_repo_dir" > /dev/null
echo '3' > 3.txt
- git add .
- git commit -m 'third commit'
+ _git add .
+ _git commit -m 'third commit'
popd > /dev/null
}
@@ -105,7 +116,7 @@ setup_workdir() {
echo ----------------------------------------------------------------------
mkdir -p -- "$output_dir"
- git clone --quiet -- "$upstream_repo_dir" "$output_dir/test_repo"
+ _git clone --quiet -- "$upstream_repo_dir" "$output_dir/test_repo"
}
cgitize() {
@@ -144,7 +155,7 @@ verify_commits() {
pushd -- "$output_dir" > /dev/null &&
cd -- test_repo.git &&
local output &&
- output="$( git log --oneline )" &&
+ output="$( _git log --oneline )" &&
echo "$output" &&
check_contains "$output" "$@" &&
popd > /dev/null