Skip to content

Commit

Permalink
Use fixtures.pulpproject.org for bats tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Mar 6, 2024
1 parent 637ee8b commit d1b4921
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 71 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ packer/build.*

# mkdocs
/site

# bats
bats/cvv_content*
bats/library_*
bats/fixtures.pulpproject.org/
bats/import_repos
66 changes: 33 additions & 33 deletions bats/fb-katello-content.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ setup() {
@test "create package repository" {
hammer repository create --organization="${ORGANIZATION}" \
--product="${PRODUCT}" --content-type="yum" --name "${YUM_REPOSITORY}" \
--url https://jlsherrill.fedorapeople.org/fake-repos/needed-errata/ | grep -q "Repository created"
--url https://fixtures.pulpproject.org/rpm-packages-updateinfo/ | grep -q "Repository created"
}

@test "upload package" {
(cd /tmp; curl -O https://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/test_errata_install/animaniacs-0.1-1.noarch.rpm)
(cd /tmp; curl -O https://fixtures.pulpproject.org/rpm-richnweak-deps/bourbon-5-10.noarch.rpm)
hammer repository upload-content --organization="${ORGANIZATION}"\
--product="${PRODUCT}" --name="${YUM_REPOSITORY}" --path="/tmp/animaniacs-0.1-1.noarch.rpm" | grep -q "Successfully uploaded"
--product="${PRODUCT}" --name="${YUM_REPOSITORY}" --path="/tmp/bourbon-5-10.noarch.rpm" | grep -q "Successfully uploaded"
}

@test "sync repository" {
Expand Down Expand Up @@ -227,7 +227,7 @@ setup() {
--content-view="${CONTENT_VIEW}" --id="$export_version_id"
actual_size=$(du -k "$(hammer --output csv --no-headers content-export list --content-view-version-id=$export_version_id --fields="path" --per-page=1)"/*.tar* | cut -f 1)
# actual size of export should be less than 14K
[ $actual_size -le 87 ]
[ $actual_size -le 100 ]
}

@test "perform an incremental library export" {
Expand Down Expand Up @@ -273,7 +273,7 @@ setup() {
@test "create and sync modules-rpms repo" {
hammer repository create --organization="${ORGANIZATION}" \
--product="${PRODUCT}" --content-type="yum" --name "${YUM_REPOSITORY_2}" \
--url https://partha.fedorapeople.org/test-repos/separated/modules-rpms/ | grep -q "Repository created"
--url https://fixtures.pulpproject.org/rpm-with-modules/ | grep -q "Repository created"
hammer repository synchronize --organization="${ORGANIZATION}" \
--product="${PRODUCT}" --name="${YUM_REPOSITORY_2}"
}
Expand All @@ -282,7 +282,7 @@ setup() {
@test "create and sync rpm-deps repo" {
hammer repository create --organization="${ORGANIZATION}" \
--product="${PRODUCT}" --content-type="yum" --name "${YUM_REPOSITORY_3}" \
--url https://partha.fedorapeople.org/test-repos/separated/rpm-deps/ | grep -q "Repository created"
--url https://fixtures.pulpproject.org/rpm-richnweak-deps/ | grep -q "Repository created"
hammer repository synchronize --organization="${ORGANIZATION}" \
--product="${PRODUCT}" --name="${YUM_REPOSITORY_3}"
}
Expand Down Expand Up @@ -359,7 +359,7 @@ setup() {
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
| grep "${CONTENT_VIEW_2}" | cut -d, -f1)
hammer content-view version incremental-update --organization="${ORGANIZATION}" \
--content-view-version-id=$cvv_id --errata-ids=WALRUS-2013:0002 --propagate-all-composites=true \
--content-view-version-id=$cvv_id --errata-ids=RHEA-2012:0055 --propagate-all-composites=true \
--lifecycle-environments="Library"
}

Expand All @@ -383,18 +383,18 @@ setup() {
@test "ensure component cv 1 latest version has proper content" {
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
| grep "${CONTENT_VIEW_2} 1.1" | cut -d, -f1)
hammer package list --content-view-version-id=$cvv_id --order='name DESC' --fields='filename' > cvv_content
diff cvv_content fixtures/component_1_rpms
hammer package list --content-view-version-id=$cvv_id --order='name DESC' --fields='filename' > cvv_content_rpms
diff cvv_content_rpms fixtures/component_1_rpms

hammer erratum list --content-view-version-id=$cvv_id --order='id' --fields='Errata ID' > cvv_content
diff cvv_content fixtures/component_1_errata
hammer erratum list --content-view-version-id=$cvv_id --order='id' --fields='Errata ID' > cvv_content_errata
diff cvv_content_errata fixtures/component_1_errata

hammer module-stream list --content-view-version-id=$cvv_id --order='stream id' \
--fields="module stream name,stream,version,architecture,context" > cvv_content
diff cvv_content fixtures/component_1_modulemds
--fields="module stream name,stream,version,architecture,context" > cvv_content_modulemds
diff cvv_content_modulemds fixtures/component_1_modulemds

hammer docker tag list --content-view-version-id=$cvv_id --fields="tag" --order="name" > cvv_content
diff cvv_content fixtures/component_1_docker_tags
hammer docker tag list --content-view-version-id=$cvv_id --fields="tag" --order="name" > cvv_content_docker_tags
diff cvv_content_docker_tags fixtures/component_1_docker_tags

# Only checking for the v2 manifest due to Pulp2/Pulp3 differences
hammer docker manifest list --content-view-version-id=$cvv_id --fields="schema version,digest,tags" \
Expand All @@ -404,22 +404,22 @@ setup() {
@test "ensure component cv 2 latest version has proper content" {
cvv_id=$(hammer --csv --no-headers content-view version list --organization="${ORGANIZATION}" \
| grep "${CONTENT_VIEW} 2.0" | cut -d, -f1)
hammer package list --content-view-version-id=$cvv_id --order='name DESC' --fields='filename' > cvv_content
diff cvv_content fixtures/component_2_rpms
hammer package list --content-view-version-id=$cvv_id --order='name DESC' --fields='filename' > cvv_content_rpms_2
diff cvv_content_rpms_2 fixtures/component_2_rpms

hammer erratum list --content-view-version-id=$cvv_id --order='id' --fields='Errata ID' > cvv_content
diff cvv_content fixtures/component_2_errata
hammer erratum list --content-view-version-id=$cvv_id --order='id' --fields='Errata ID' > cvv_content_errata_2
diff cvv_content_errata_2 fixtures/component_2_errata

hammer module-stream list --content-view-version-id=$cvv_id --order='stream id' \
--fields="module stream name,stream,version,architecture,context" > cvv_content
diff cvv_content fixtures/component_2_modulemds
--fields="module stream name,stream,version,architecture,context" > cvv_content_modulemds_2
diff cvv_content_modulemds_2 fixtures/component_2_modulemds

hammer docker tag list --content-view-version-id=$cvv_id --fields="tag" --order="name" > cvv_content
diff cvv_content fixtures/component_2_docker_tags
hammer docker tag list --content-view-version-id=$cvv_id --fields="tag" --order="name" > cvv_content_docker_tags_2
diff cvv_content_docker_tags_2 fixtures/component_2_docker_tags

hammer docker manifest list --content-view-version-id=$cvv_id --fields="schema version,digest,tags" \
--order='tag' > cvv_content
diff cvv_content fixtures/component_2_docker_manifests
--order='tag' > cvv_content_docker_manifests_2
diff cvv_content_docker_manifests_2 fixtures/component_2_docker_manifests
}

@test "ensure composite cv latest version has proper content" {
Expand All @@ -428,18 +428,18 @@ setup() {

# Sorting and removing duplicates due to Pulp2/Pulp3 differences (https://projects.theforeman.org/issues/30755)
hammer package list --content-view-version-id=$cvv_id --order='name DESC' --fields='filename' \
| awk '!seen[$0]++' > cvv_content
diff -w cvv_content fixtures/composite_rpms
| awk '!seen[$0]++' > cvv_content_rpms_composite
diff -w cvv_content_rpms_composite fixtures/composite_rpms

hammer erratum list --content-view-version-id=$cvv_id --order='id' --fields='Errata ID' > cvv_content
diff cvv_content fixtures/composite_errata
hammer erratum list --content-view-version-id=$cvv_id --order='id' --fields='Errata ID' > cvv_content_errata_composite
diff cvv_content_errata_composite fixtures/composite_errata

hammer module-stream list --content-view-version-id=$cvv_id --order='stream id' \
--fields="module stream name,stream,version,architecture,context" > cvv_content
diff cvv_content fixtures/composite_modulemds
--fields="module stream name,stream,version,architecture,context" > cvv_content_modulemds_composite
diff cvv_content_modulemds_composite fixtures/composite_modulemds

hammer docker tag list --content-view-version-id=$cvv_id --fields="tag" --order="name" > cvv_content
diff cvv_content fixtures/composite_docker_tags
hammer docker tag list --content-view-version-id=$cvv_id --fields="tag" --order="name" > cvv_content_docker_tags_composite
diff cvv_content_docker_tags_composite fixtures/composite_docker_tags

# Only checking for the v2 manifest due to Pulp2/Pulp3 differences
hammer docker manifest list --content-view-version-id=$cvv_id --fields="schema version,digest,tags" \
Expand Down
10 changes: 5 additions & 5 deletions bats/fixtures/component_1_errata
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
----------------
ERRATA ID
----------------
WALRUS-2013:0002
----------------
--------------
ERRATA ID
--------------
RHEA-2012:0055
--------------
4 changes: 2 additions & 2 deletions bats/fixtures/component_1_modulemds
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-------------------|--------|----------------|--------------|---------
MODULE STREAM NAME | STREAM | VERSION | ARCHITECTURE | CONTEXT
-------------------|--------|----------------|--------------|---------
walrus | 0.71 | 20190707165243 | x86_64 | d0ffee42
walrus | 5.21 | 20190704144203 | x86_64 | deadbeef
kangaroo | 0 | 20180730223407 | noarch | deadbeef
walrus | 5.21 | 20180704144203 | x86_64 | deadbeef
-------------------|--------|----------------|--------------|---------
27 changes: 18 additions & 9 deletions bats/fixtures/component_1_rpms
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
------------------------
FILENAME
------------------------
whale-0.2-1.noarch.rpm
walrus-0.71-1.noarch.rpm
walrus-5.21-1.noarch.rpm
stork-0.12-2.noarch.rpm
shark-0.1-1.noarch.rpm
------------------------
-----------------------------
FILENAME
-----------------------------
wolf-9.4-2.noarch.rpm
whale-0.2-1.noarch.rpm
walrus-5.21-1.noarch.rpm
tiger-1.0-4.noarch.rpm
stork-0.12-2.noarch.rpm
shark-0.1-1.noarch.rpm
pike-2.2-1.noarch.rpm
penguin-0.9.1-1.noarch.rpm
lion-0.4-1.noarch.rpm
kangaroo-0.3-1.noarch.rpm
elephant-8.3-1.noarch.rpm
dolphin-3.10.232-1.noarch.rpm
crow-0.8-1.noarch.rpm
bear-4.1-1.noarch.rpm
-----------------------------
3 changes: 0 additions & 3 deletions bats/fixtures/component_2_errata
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@
ERRATA ID
--------------
RHEA-2012:0055
RHEA-2012:0056
RHEA-2012:0057
RHEA-2012:0058
--------------
3 changes: 3 additions & 0 deletions bats/fixtures/component_2_rpms
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ penguin-0.9.1-1.noarch.rpm
mouse-0.1.12-1.noarch.rpm
lion-0.4-1.noarch.rpm
kangaroo-0.2-1.noarch.rpm
kangaroo-0.3-1.noarch.rpm
horse-0.22-2.noarch.rpm
gorilla-0.62-1.noarch.rpm
giraffe-0.67-2.noarch.rpm
frog-0.1-1.noarch.rpm
fox-1.1-2.noarch.rpm
elephant-8.3-1.noarch.rpm
duck-0.6-1.noarch.rpm
duck-0.7-1.noarch.rpm
duck-0.8-1.noarch.rpm
dolphin-3.10.232-1.noarch.rpm
dog-4.23-1.noarch.rpm
crow-0.8-1.noarch.rpm
Expand Down
14 changes: 5 additions & 9 deletions bats/fixtures/composite_errata
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
----------------
ERRATA ID
----------------
RHEA-2012:0055
RHEA-2012:0056
RHEA-2012:0057
RHEA-2012:0058
WALRUS-2013:0002
----------------
--------------
ERRATA ID
--------------
RHEA-2012:0055
--------------
4 changes: 2 additions & 2 deletions bats/fixtures/composite_modulemds
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-------------------|--------|----------------|--------------|---------
MODULE STREAM NAME | STREAM | VERSION | ARCHITECTURE | CONTEXT
-------------------|--------|----------------|--------------|---------
walrus | 0.71 | 20190707165243 | x86_64 | d0ffee42
walrus | 5.21 | 20190704144203 | x86_64 | deadbeef
kangaroo | 0 | 20180730223407 | noarch | deadbeef
walrus | 5.21 | 20180704144203 | x86_64 | deadbeef
-------------------|--------|----------------|--------------|---------
19 changes: 11 additions & 8 deletions bats/fixtures/composite_rpms
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ penguin-0.9.1-1.noarch.rpm
mouse-0.1.12-1.noarch.rpm
lion-0.4-1.noarch.rpm
kangaroo-0.2-1.noarch.rpm
kangaroo-0.3-1.noarch.rpm
horse-0.22-2.noarch.rpm
gorilla-0.62-1.noarch.rpm
giraffe-0.67-2.noarch.rpm
frog-0.1-1.noarch.rpm
fox-1.1-2.noarch.rpm
elephant-8.3-1.noarch.rpm
duck-0.6-1.noarch.rpm
duck-0.7-1.noarch.rpm
duck-0.8-1.noarch.rpm
dolphin-3.10.232-1.noarch.rpm
dog-4.23-1.noarch.rpm
crow-0.8-1.noarch.rpm
cow-2.2-3.noarch.rpm
cockateel-3.1-1.noarch.rpm
chimpanzee-0.21-1.noarch.rpm
cheetah-1.25.3-5.noarch.rpm
cat-1.0-1.noarch.rpm
camel-0.1-1.noarch.rpm
bear-4.1-1.noarch.rpm
crow-0.8-1.noarch.rpm
cow-2.2-3.noarch.rpm
cockateel-3.1-1.noarch.rpm
chimpanzee-0.21-1.noarch.rpm
cheetah-1.25.3-5.noarch.rpm
cat-1.0-1.noarch.rpm
camel-0.1-1.noarch.rpm
bear-4.1-1.noarch.rpm

0 comments on commit d1b4921

Please sign in to comment.