-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include test cases from former pulp-ostree issues
closes #59
- Loading branch information
Showing
6 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added more tests to verify the functionality of importing child commits. |
53 changes: 53 additions & 0 deletions
53
tests/scripts/pulp_ostree/test_importing_commits_with_import_all.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/sh | ||
|
||
# shellcheck source=tests/scripts/config.source | ||
. "$(dirname "$(dirname "$(realpath "$0")")")/config.source" | ||
|
||
cleanup() { | ||
pulp ostree repository destroy --name "cli_test_ostree_repository_import_all_only" || true | ||
pulp ostree distribution destroy --name "cli_test_ostree_distro_import_all_only" || true | ||
pulp orphan cleanup || true | ||
} | ||
trap cleanup EXIT | ||
|
||
workdir=$(mktemp -d) | ||
cd "${workdir}" | ||
|
||
# prepare pulp | ||
expect_succ pulp ostree repository create --name "cli_test_ostree_repository_import_all_only" | ||
expect_succ pulp ostree distribution create --name "cli_test_ostree_distro_import_all_only" \ | ||
--repository "cli_test_ostree_repository_import_all_only" \ | ||
--base-path "cli_test_ostree_distro_import_all_only" | ||
|
||
# first commit | ||
mkdir "${workdir}/first" | ||
cd "${workdir}/first" | ||
ostree --repo="${workdir}/first/repo" init --mode=archive | ||
mkdir "${workdir}/first/files" | ||
echo "one" > files/file.txt | ||
commit=$( | ||
ostree commit --repo "${workdir}/first/repo" --branch ostree-main "${workdir}/first/files/" | ||
) | ||
|
||
cd "${workdir}/first" | ||
tar czvf repo.tar "repo/" | ||
|
||
# first upload | ||
expect_succ pulp ostree repository import-all --name "cli_test_ostree_repository_import_all_only" \ | ||
--file "repo.tar" \ | ||
--repository_name "repo" | ||
|
||
# second commit | ||
mkdir "${workdir}/second" | ||
cd "${workdir}/second" | ||
mkdir files | ||
echo "two" > files/file2.txt | ||
ostree --repo="${workdir}/second/repo" init --mode=archive | ||
ostree commit --repo repo --branch ostree-main files/ --parent="${commit}" | ||
tar czvf repo.tar repo/ | ||
|
||
# second upload | ||
echo "Uploading and importing second repo" | ||
expect_succ pulp ostree repository import-all --name "cli_test_ostree_repository_import_all_only" \ | ||
--file "repo.tar" \ | ||
--repository_name "repo" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/sh | ||
|
||
# shellcheck source=tests/scripts/config.source | ||
. "$(dirname "$(dirname "$(realpath "$0")")")/config.source" | ||
|
||
cleanup() { | ||
pulp ostree repository destroy --name "cli_test_ostree_repository_two_refs" || true | ||
pulp ostree distribution destroy --name "cli_test_ostree_distro_two_refs" || true | ||
pulp orphan cleanup || true | ||
} | ||
trap cleanup EXIT | ||
|
||
workdir=$(mktemp -d) | ||
cd "${workdir}" | ||
|
||
# prepare pulp | ||
expect_succ pulp ostree repository create --name "cli_test_ostree_repository_two_refs" | ||
expect_succ pulp ostree distribution create --name "cli_test_ostree_distro_two_refs" \ | ||
--repository "cli_test_ostree_repository_two_refs" \ | ||
--base-path "cli_test_ostree_distro_two_refs" | ||
|
||
BASE_URL=$(echo "$OUTPUT" | jq -r ".base_url") | ||
|
||
# first commit | ||
mkdir "${workdir}/first" | ||
cd "${workdir}/first" | ||
ostree --repo="${workdir}/first/repo" init --mode=archive | ||
mkdir "${workdir}/first/files" | ||
echo "one" > files/file.txt | ||
ostree commit --repo "${workdir}/first/repo" --branch first "${workdir}/first/files/" | ||
|
||
cd "${workdir}/first" | ||
tar czvf repo.tar "repo/" | ||
|
||
# first upload | ||
expect_succ pulp ostree repository import-all \ | ||
--name "cli_test_ostree_repository_two_refs" \ | ||
--file "repo.tar" \ | ||
--repository_name "repo" | ||
|
||
# local remote repo | ||
ostree --repo="${workdir}/rremote" init | ||
ostree --repo="${workdir}/rremote" remote add --no-gpg-verify iot "$BASE_URL" | ||
ostree --repo="${workdir}/rremote" remote refs iot | ||
ostree --repo="${workdir}/rremote" remote summary iot | ||
|
||
# second commit | ||
mkdir "${workdir}/second" | ||
cd "${workdir}/second" | ||
mkdir files | ||
echo "two" > files/file2.txt | ||
ostree --repo="${workdir}/second/repo" init --mode=archive | ||
ostree commit --repo repo --branch second files/ | ||
tar czvf repo.tar repo/ | ||
|
||
# second upload | ||
expect_succ pulp ostree repository import-all \ | ||
--name "cli_test_ostree_repository_two_refs" \ | ||
--file "repo.tar" \ | ||
--repository_name "repo" | ||
|
||
# fetch refs | ||
ostree --repo="${workdir}/rremote" remote refs iot | ||
ostree --repo="${workdir}/rremote" remote summary iot | ||
expect_succ ostree --repo="${workdir}/rremote" pull iot second | ||
expect_succ ostree --repo="${workdir}/rremote" pull iot first |
File renamed without changes.
File renamed without changes.