Skip to content

Commit

Permalink
Move tests from master to main (take#1)
Browse files Browse the repository at this point in the history
Note that not all tests can be moved to main, specifically those
using commits from other repos that still have the master branch
around.
  • Loading branch information
stronk7 committed Dec 20, 2023
1 parent 4dc3cb8 commit 5687f4b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion remote_branch_checker/remote_branch_checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# $rebasewarn: Max number of days allowed since rebase. Warning if exceeded. Defaults to 20.
# $rebaseerror: Max number of days allowed since rebase. Error if exceeded. Defaults to 60.
# $npmcmd: Optional, path to the npm executable (global)
# $pushremote: (optional) Remote to push the results of prechecker to. Will create branches like MDL-1234-master-shorthash
# $pushremote: (optional) Remote to push the results of prechecker to. Will create branches like MDL-1234-main-shorthash
# $resettocommit: (optional) Should not be used in production runs. Reset $integrateto to a commit for testing purposes.

# Don't want debugging @ start, but want exit on error
Expand Down
28 changes: 14 additions & 14 deletions tests/1-compare_databases.bats
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ setup () {
export dbuser1=$LOCAL_CI_TESTS_DBUSER
export dbpass1=$LOCAL_CI_TESTS_DBPASS

create_git_branch master 35d5053ba20432059b497d85e39175d356f44fb4
create_git_branch main 35d5053ba20432059b497d85e39175d356f44fb4
}

teardown () {
echo $BATS_TEST_NAME > /tmp/file
# Not all tests use the "compare_databases" branch.
if [[ $BATS_TEST_NAME =~ "problems_are_detected" ]]; then
cd $gitdir
git checkout master
git checkout main
git branch -D compare_databases -q
cd $OLDPWD
fi;
}

@test "compare_databases/compare_databases.sh: missing env variables" {
export gitbranchinstalled=master
export gitbranchinstalled=main
export gitbranchupgraded=MOODLE_31_STABLE
export dbtype=

Expand All @@ -50,22 +50,22 @@ teardown () {

@test "compare_databases/compare_databases.sh: single actual (> 401_STABLE) branch runs work" {
# TODO: Change this to stable branches when we have more supporting php82.
export gitbranchinstalled=master
export gitbranchinstalled=main
export gitbranchupgraded=MOODLE_402_STABLE

ci_run compare_databases/compare_databases.sh
assert_success
assert_output --partial 'Info: Origin branches: (1) MOODLE_402_STABLE'
assert_output --partial 'Info: Target branch: master'
assert_output --partial 'Info: Installing Moodle master into ci_installed_'
assert_output --partial 'Info: Comparing master and upgraded MOODLE_402_STABLE'
assert_output --partial 'Info: Target branch: main'
assert_output --partial 'Info: Installing Moodle main into ci_installed_'
assert_output --partial 'Info: Comparing main and upgraded MOODLE_402_STABLE'
assert_output --partial 'Info: Installing Moodle MOODLE_402_STABLE into ci_upgraded_'
assert_output --partial 'Info: Upgrading Moodle MOODLE_402_STABLE to master into ci_upgraded_'
assert_output --partial 'Info: Upgrading Moodle MOODLE_402_STABLE to main into ci_upgraded_'
assert_output --partial 'Info: Comparing databases ci_installed_'
assert_output --partial 'Info: OK. No problems comparing databases ci_installed_'
assert_output --partial 'Ok: Process ended without errors'
refute_output --partial 'Error: Process ended with'
run [ -f $WORKSPACE/compare_databases_master_logfile.txt ]
run [ -f $WORKSPACE/compare_databases_main_logfile.txt ]
assert_success
}

Expand All @@ -92,18 +92,18 @@ teardown () {

@test "compare_databases/compare_databases.sh: multiple branch runs work" {
# TODO: Change this to different stable branches when we have more supporting php82.
export gitbranchinstalled=master
export gitbranchinstalled=main
export gitbranchupgraded=v4.2.1,MOODLE_402_STABLE

ci_run compare_databases/compare_databases.sh
assert_success
assert_output --partial 'Info: Origin branches: (2) v4.2.1,MOODLE_402_STABLE'
assert_output --partial 'Info: Target branch: master'
assert_output --partial 'Info: Comparing master and upgraded v4.2.1'
assert_output --partial 'Info: Comparing master and upgraded MOODLE_402_STABLE'
assert_output --partial 'Info: Target branch: main'
assert_output --partial 'Info: Comparing main and upgraded v4.2.1'
assert_output --partial 'Info: Comparing main and upgraded MOODLE_402_STABLE'
assert_output --partial 'Ok: Process ended without errors'
refute_output --partial 'Error: Process ended with'
run [ -f $WORKSPACE/compare_databases_master_logfile.txt ]
run [ -f $WORKSPACE/compare_databases_main_logfile.txt ]
assert_success
}

Expand Down
2 changes: 1 addition & 1 deletion tests/1-illegal_whitespace.bats
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ teardown () {
uit="$tmpdir/example space"
mkdir -p "${uit}"
export gitdir="${uit}"
export gitbranch="master"
export gitbranch="main"
ci_run illegal_whitespace/illegal_whitespace.sh
assert_success
}
4 changes: 2 additions & 2 deletions tests/1-travis-branch-checker.bats
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ load libs/shared_setup
ci_run_php travis/check_branch_status.php --repository=https://github.com/moodlehq/moodle-local_ci
assert_failure

ci_run_php travis/check_branch_status.php --branch=master
ci_run_php travis/check_branch_status.php --branch=main
assert_failure
}

Expand Down Expand Up @@ -41,7 +41,7 @@ load libs/shared_setup

@test "travis/check_branch_status.php: not github repo" {
# Travis only works with github repos, so skip non-github ones
ci_run_php travis/check_branch_status.php --repository=git://git.moodle.org/moodle.git --branch=master
ci_run_php travis/check_branch_status.php --repository=git://git.moodle.org/moodle.git --branch=main
assert_success
assert_output 'SKIP: Skipping checks. git://git.moodle.org/moodle.git Not a github repo.'
}
4 changes: 2 additions & 2 deletions tests/3-git_sync_two_branches.bats
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ setup() {
# Set the rest of env variables needed for the script.
export gitremote=local_ci_tests

# Let's checkout master, so we test everything without any local checkout of the branches.
git checkout master --quiet
# Let's checkout main, so we test everything without any local checkout of the branches.
git checkout main --quiet
cd $OLDPWD
}

Expand Down
2 changes: 1 addition & 1 deletion tests/3-prepare_npm_stuff.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
load libs/shared_setup

setup () {
create_git_branch master origin/master
create_git_branch main origin/main
rm -fr $gitdir/node_modules
rm -fr $gitdir/npm-shrinkwrap.json
}
Expand Down

0 comments on commit 5687f4b

Please sign in to comment.