Restore the tests in test_run_ci_on_github_repo.bats in the updated code, which has been restructured and improved towards Google Bash Style guide compliance. This requires some effort. The first test of this file passes. Currently the second test is being restored:
@test "Test copying github branches with yaml to GitLab repo." {
local github_username="a-t-0"
local github_repo_name="sponsor_example"
# Delete the repository locally if it exists.
remove_dir "$MIRROR_LOCATION/GitHub/$github_repo_name"
manual_assert_dir_not_exists "$MIRROR_LOCATION/GitHub/$github_repo_name"
# TODO: change this method to download with https?
# Download the GitHub repo on which to run the GitLab CI:
download_github_repo_on_which_to_run_ci "$github_username" "$github_repo_name"
manual_assert_dir_exists "$MIRROR_LOCATION/GitHub/$github_repo_name"
repo_was_cloned=$(verify_github_repository_is_cloned "$github_repo_name" "$MIRROR_LOCATION/GitHub/$github_repo_name")
assert_equal "$repo_was_cloned" "FOUND"
copy_github_branches_with_yaml_to_gitlab_repo "$github_username" "$github_repo_name"
# TODO: write some assert to verify yamls are copied to GitLab repo.
# Delete the repository locally if it exists.
remove_dir "$MIRROR_LOCATION/GitHub/$github_repo_name"
manual_assert_dir_not_exists "$MIRROR_LOCATION/GitHub/$github_repo_name"
}
An issue in this test is that it requires using the GitLab personal access token, which has not yet been generated by the .install_gitlab.sh -s -r command. This test requires that token because it runs:
copy_github_branches_with_yaml_to_gitlab_repo
From
run_ci_on_github_repo.sh
which calls:
get_project_list(){
which asks the repositories from the GitLab API using the GitLab personal access token. Additionally, the function to manually create this token:
create_gitlab_personal_access_token()
in file: create_personal_access_token.sh throws an error.
Solution
[x] First ensure the create_gitlab_personal_access_token() works.
[x] Manually verify it works.
[x] Then manually verify get_project_list(){ works.
[x] Then manually verify copy_github_branches_with_yaml_to_gitlab_repo() { works.
[x] # TODO: determine why
# The commit:aeaaa57120f74a695ef4215e819a175296a3de10 does not yet have a build status, and it DOES have a GitLab yaml.
# even though the gitlab-ci-build-statuses repository does have that build status.
[ ] Then restore the remainder of the tests.
[ ] Then create/call the receipe to run this GitLab CI on GitHub from `./install_gitlab.sh -s -r
[ ] Then create a function that loops over all the repositories of a GitHub user and runs the CI on them
[ ] Then create a monitoring script that detects changes in the GitHub repo and runs the CI on them.
[ ] Create a separate issue to: Write a test that verifies create_gitlab_personal_access_token() works.
[ ] Create a separate issue to verify/ensure (and test) that the install_gitlab.sh -s -r command automatically generates this GitLab token. Ps. I expect that the code does do that automatically (if it works) but that it fails at doing so because of the error that is thrown by the create_gitlab_personal_access_token() function. So perhaps before creating a call to the function, see if such a call already exists.
Restore the tests in
test_run_ci_on_github_repo.bats
in the updated code, which has been restructured and improved towards Google Bash Style guide compliance. This requires some effort. The first test of this file passes. Currently the second test is being restored:An issue in this test is that it requires using the GitLab personal access token, which has not yet been generated by the
.install_gitlab.sh -s -r
command. This test requires that token because it runs:From
which calls:
which asks the repositories from the GitLab API using the GitLab personal access token. Additionally, the function to manually create this token:
in file:
create_personal_access_token.sh
throws an error.Solution
[x] First ensure the
create_gitlab_personal_access_token()
works.[x] Manually verify it works.
[x] Then manually verify
get_project_list(){
works.[x] Then manually verify
copy_github_branches_with_yaml_to_gitlab_repo() {
works.[x] # TODO: determine why
[ ] Then restore the remainder of the tests.
[ ] Then create/call the receipe to run this GitLab CI on GitHub from `./install_gitlab.sh -s -r
[ ] Then create a function that loops over all the repositories of a GitHub user and runs the CI on them
[ ] Then create a monitoring script that detects changes in the GitHub repo and runs the CI on them.
[ ] Create a separate issue to: Write a test that verifies
create_gitlab_personal_access_token()
works.[ ] Create a separate issue to verify/ensure (and test) that the
install_gitlab.sh -s -r
command automatically generates this GitLab token. Ps. I expect that the code does do that automatically (if it works) but that it fails at doing so because of the error that is thrown by thecreate_gitlab_personal_access_token()
function. So perhaps before creating a call to the function, see if such a call already exists.