summaryrefslogtreecommitdiff
path: root/tools/functional_tests.sh
diff options
context:
space:
mode:
authorRichard Hansen <rhansen@rhansen.org>2016-01-24 00:15:44 -0500
committerRichard Hansen <rhansen@rhansen.org>2016-01-31 16:25:37 -0500
commit37f6d42a60c6c37ab3b33518d04a268116757c4c (patch)
tree9cc08743d794a3cf10aa495cb8f017cee3848a80 /tools/functional_tests.sh
parent033881e3195388b9f92765a68e5c713953f9086e (diff)
downloadgitlab-37f6d42a60c6c37ab3b33518d04a268116757c4c.tar.gz
define a testcase() function; use it for tests
Diffstat (limited to 'tools/functional_tests.sh')
-rwxr-xr-xtools/functional_tests.sh102
1 files changed, 49 insertions, 53 deletions
diff --git a/tools/functional_tests.sh b/tools/functional_tests.sh
index 0282b30..fefb5af 100755
--- a/tools/functional_tests.sh
+++ b/tools/functional_tests.sh
@@ -18,69 +18,65 @@ setenv_script=$(dirname "$0")/build_test_env.sh || exit 1
BUILD_TEST_ENV_AUTO_CLEANUP=true
. "$setenv_script" "$@" || exit 1
-printf %s "Testing project creation... "
-OUTPUT=$(try GITLAB project create --name test-project1) || exit 1
-PROJECT_ID=$(pecho "${OUTPUT}" | grep ^id: | cut -d' ' -f2)
-OUTPUT=$(try GITLAB project list) || exit 1
-pecho "${OUTPUT}" | grep -q test-project1 || fatal "test failed"
-OK
+testcase "project creation" '
+ OUTPUT=$(try GITLAB project create --name test-project1) || exit 1
+ PROJECT_ID=$(pecho "${OUTPUT}" | grep ^id: | cut -d" " -f2)
+ OUTPUT=$(try GITLAB project list) || exit 1
+ pecho "${OUTPUT}" | grep -q test-project1
+'
-printf %s "Testing project update... "
-GITLAB project update --id "$PROJECT_ID" --description "My New Description" \
- || fatal "test failed"
-OK
+testcase "project update" '
+ GITLAB project update --id "$PROJECT_ID" --description "My New Description"
+'
-printf %s "Testing user creation... "
-OUTPUT=$(GITLAB user create --email fake@email.com --username user1 \
- --name "User One" --password fakepassword) || fatal "test failed"
-OK
+testcase "user creation" '
+ OUTPUT=$(GITLAB user create --email fake@email.com --username user1 \
+ --name "User One" --password fakepassword)
+'
USER_ID=$(pecho "${OUTPUT}" | grep ^id: | cut -d' ' -f2)
-printf %s "Testing verbose output... "
-OUTPUT=$(try GITLAB -v user list) || exit 1
-pecho "${OUTPUT}" | grep -q avatar-url || fatal "test failed"
-OK
+testcase "verbose output" '
+ OUTPUT=$(try GITLAB -v user list) || exit 1
+ pecho "${OUTPUT}" | grep -q avatar-url
+'
-printf %s "Testing CLI args not in output... "
-OUTPUT=$(try GITLAB -v user list) || exit 1
-pecho "${OUTPUT}" | grep -qv config-file || fatal "test failed"
-OK
+testcase "CLI args not in output" '
+ OUTPUT=$(try GITLAB -v user list) || exit 1
+ pecho "${OUTPUT}" | grep -qv config-file
+'
-printf %s "Testing adding member to a project... "
-GITLAB project-member create --project-id "$PROJECT_ID" \
- --user-id "$USER_ID" --access-level 40 >/dev/null 2>&1 \
- || fatal "test failed"
-OK
+testcase "adding member to a project" '
+ GITLAB project-member create --project-id "$PROJECT_ID" \
+ --user-id "$USER_ID" --access-level 40 >/dev/null 2>&1
+'
-printf %s "Testing file creation... "
-GITLAB project-file create --project-id "$PROJECT_ID" \
- --file-path README --branch-name master --content "CONTENT" \
- --commit-message "Initial commit" >/dev/null 2>&1 || fatal "test failed"
-OK
+testcase "file creation" '
+ GITLAB project-file create --project-id "$PROJECT_ID" \
+ --file-path README --branch-name master --content "CONTENT" \
+ --commit-message "Initial commit" >/dev/null 2>&1
+'
-printf %s "Testing issue creation... "
-OUTPUT=$(GITLAB project-issue create --project-id "$PROJECT_ID" \
- --title "my issue" --description "my issue description") \
- || fatal "test failed"
-OK
+testcase "issue creation" '
+ OUTPUT=$(GITLAB project-issue create --project-id "$PROJECT_ID" \
+ --title "my issue" --description "my issue description")
+'
ISSUE_ID=$(pecho "${OUTPUT}" | grep ^id: | cut -d' ' -f2)
-printf %s "Testing note creation... "
-GITLAB project-issue-note create --project-id "$PROJECT_ID" \
- --issue-id "$ISSUE_ID" --body "the body" >/dev/null 2>&1 \
- || fatal "test failed"
-OK
+testcase "note creation" '
+ GITLAB project-issue-note create --project-id "$PROJECT_ID" \
+ --issue-id "$ISSUE_ID" --body "the body" >/dev/null 2>&1
+'
-printf %s "Testing branch creation... "
-GITLAB project-branch create --project-id "$PROJECT_ID" \
- --branch-name branch1 --ref master >/dev/null 2>&1 || fatal "test failed"
-OK
+testcase "branch creation" '
+ GITLAB project-branch create --project-id "$PROJECT_ID" \
+ --branch-name branch1 --ref master >/dev/null 2>&1
+'
-printf %s "Testing branch deletion... "
-GITLAB project-branch delete --project-id "$PROJECT_ID" \
- --name branch1 >/dev/null 2>&1 || fatal "test failed"
-OK
+testcase "branch deletion" '
+ GITLAB project-branch delete --project-id "$PROJECT_ID" \
+ --name branch1 >/dev/null 2>&1
+'
-printf %s "Testing project deletion... "
-GITLAB project delete --id "$PROJECT_ID" || fatal "test failed"
-OK
+testcase "project deletion" '
+ GITLAB project delete --id "$PROJECT_ID"
+'