Skip to content

Commit

Permalink
test: Add nginx to the image request
Browse files Browse the repository at this point in the history
  • Loading branch information
ezr-ondrej committed Dec 13, 2023
1 parent 5324372 commit 6c000c2
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 9 deletions.
20 changes: 20 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,26 @@ API:
- aws/rhel-9.2-ga-aarch64
INTERNAL_NETWORK: ["true"]

API-module-hotfixes:
stage: test
extends: .terraform
rules:
- !reference [.upstream_rules_all, rules]
# note: cloud API is not supported for on-prem installations so
# don't run this test case for nightly trees
script:
- schutzbot/deploy.sh
- TEST_MODULE_HOTFIXES=1 /usr/libexec/tests/osbuild-composer/api.sh ${IMAGE_TYPE}
parallel:
matrix:
- IMAGE_TYPE:
- aws
- vsphere
RUNNER:
- aws/rhel-8.8-ga-x86_64
- aws/rhel-8.8-ga-aarch64
INTERNAL_NETWORK: ["true"]

.libvirt_integration:
stage: test
extends: .terraform/gcp
Expand Down
43 changes: 43 additions & 0 deletions internal/dnfjson/dnfjson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func TestMakeDepsolveRequest(t *testing.T) {
Name: "user-repo-2",
BaseURLs: []string{"https://example.org/user-repo-2"},
}
modHotfixRepo := rpmmd.RepoConfig{
Name: "nginx",
BaseURLs: []string{"https://example.org/nginx"},
ModuleHotfixes: common.ToPtr(true),
}
tests := []struct {
packageSets []rpmmd.PackageSet
args []transactionArgs
Expand Down Expand Up @@ -171,6 +176,44 @@ func TestMakeDepsolveRequest(t *testing.T) {
},
},
},
// module hotfixes flag is passed
{
packageSets: []rpmmd.PackageSet{
{
Include: []string{"pkg1"},
Exclude: []string{"pkg2"},
Repositories: []rpmmd.RepoConfig{baseOS, appstream, modHotfixRepo},
},
},
args: []transactionArgs{
{
PackageSpecs: []string{"pkg1"},
ExcludeSpecs: []string{"pkg2"},
RepoIDs: []string{baseOS.Hash(), appstream.Hash(), modHotfixRepo.Hash()},
},
},
wantRepos: []repoConfig{
{
ID: baseOS.Hash(),
Name: "baseos",
BaseURLs: []string{"https://example.org/baseos"},
repoHash: "fdc2e5bb6cda8e113308df9396a005b81a55ec00ec29aa0a447952ad4248d803",
},
{
ID: appstream.Hash(),
Name: "appstream",
BaseURLs: []string{"https://example.org/appstream"},
repoHash: "71c280f63a779a8bf53961ec2f15d51d052021de024a4e06ae499b8029701808",
},
{
ID: modHotfixRepo.Hash(),
Name: "nginx",
BaseURLs: []string{"https://example.org/nginx"},
ModuleHotfixes: common.ToPtr(true),
repoHash: "6ab05f54094ff2a0ee86facecae3e75e4065a01cc8caffbbbeb7505c6bfac283",
},
},
},
// 2 transactions + no package set specific repos
{
packageSets: []rpmmd.PackageSet{
Expand Down
39 changes: 38 additions & 1 deletion test/cases/api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,36 @@ EOF
)
export FIREWALL_CUSTOMIZATION_BLOCK

if [ "$TEST_MODULE_HOTFIXES" = 1 ]; then
if [ "$ARCH" = "x86_64" ]; then
NGINX_REPO_URL="https://rpmrepo.osbuild.org/v2/mirror/public/el8/el8-x86_64-nginx-20231207"
else
NGINX_REPO_URL="https://rpmrepo.osbuild.org/v2/mirror/public/el8/el8-aarch64-nginx-20231207"
fi
EXTRA_PAYLOAD_REPOS_BLOCK=$(cat <<EOF
,
{
"baseurl": "$NGINX_REPO_URL",
"check_gpg": false,
"check_repo_gpg": false,
"rhsm": false,
"module_hotfixes": true
}
EOF
)

EXTRA_PACKAGES_BLOCK=$(cat <<EOF
,
"nginx",
"nginx-module-njs"
EOF
)

fi

export EXTRA_PAYLOAD_REPOS_BLOCK
export EXTRA_PACKAGES_BLOCK

# generate a temp key for user tests
ssh-keygen -t rsa-sha2-512 -f "${WORKDIR}/usertest" -C "usertest" -N ""

Expand Down Expand Up @@ -582,9 +612,16 @@ function waitForImgState() {

#
# Make sure that requesting a non existing paquet results in failure
# or if TEST_MODULE_HOTFIXES flag is passed, we verify, that without that flag the resolve fails
#

if [ "$TEST_MODULE_HOTFIXES" != 1 ]; then
jq_edit='.customizations.packages = [ "jesuisunpaquetquinexistepas" ]'
else
jq_edit='del(.customizations.payload_repositories[] | select(.baseurl | match(".*public/el8/el8-.*-nginx-.*")) | .module_hotfixes)'
fi
REQUEST_FILE2="${WORKDIR}/request2.json"
jq '.customizations.packages = [ "jesuisunpaquetquinexistepas" ]' "$REQUEST_FILE" > "$REQUEST_FILE2"
jq "$jq_edit" "$REQUEST_FILE" > "$REQUEST_FILE2"

greenprint "Sending compose: Fail test"
sendCompose "$REQUEST_FILE2"
Expand Down
4 changes: 2 additions & 2 deletions test/cases/api/aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ function createReqFile() {
"payload_repositories": [
{
"baseurl": "$PAYLOAD_REPO_URL"
}
}${EXTRA_PAYLOAD_REPOS_BLOCK}
],
"packages": [
"postgresql",
"dummy"
"dummy"${EXTRA_PACKAGES_BLOCK}
],
"users":[
{
Expand Down
12 changes: 6 additions & 6 deletions test/cases/api/common/s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function createReqFileEdge() {
"payload_repositories": [
{
"baseurl": "$PAYLOAD_REPO_URL"
}
}${EXTRA_PAYLOAD_REPOS_BLOCK}
],
"packages": [
"postgresql",
"dummy"
"dummy"${EXTRA_PACKAGES_BLOCK}
],
"users":[
{
Expand Down Expand Up @@ -67,11 +67,11 @@ function createReqFileGuest() {
"payload_repositories": [
{
"baseurl": "$PAYLOAD_REPO_URL"
}
}${EXTRA_PAYLOAD_REPOS_BLOCK}
],
"packages": [
"postgresql",
"dummy"
"dummy"${EXTRA_PACKAGES_BLOCK}
],
"users":[
{
Expand Down Expand Up @@ -108,11 +108,11 @@ function createReqFileVSphere() {
"payload_repositories": [
{
"baseurl": "$PAYLOAD_REPO_URL"
}
}${EXTRA_PAYLOAD_REPOS_BLOCK}
],
"packages": [
"postgresql",
"dummy"
"dummy"${EXTRA_PACKAGES_BLOCK}
]${SUBSCRIPTION_BLOCK}${DIR_FILES_CUSTOMIZATION_BLOCK}
${TIMEZONE_CUSTOMIZATION_BLOCK}${FIREWALL_CUSTOMIZATION_BLOCK}
},
Expand Down

0 comments on commit 6c000c2

Please sign in to comment.