From 6c000c232c9cd1383a30c5f130d3bf106a352d94 Mon Sep 17 00:00:00 2001 From: Ondrej Ezr Date: Thu, 7 Dec 2023 13:30:16 +0100 Subject: [PATCH] test: Add nginx to the image request --- .gitlab-ci.yml | 20 +++++++++++++++ internal/dnfjson/dnfjson_test.go | 43 ++++++++++++++++++++++++++++++++ test/cases/api.sh | 39 ++++++++++++++++++++++++++++- test/cases/api/aws.sh | 4 +-- test/cases/api/common/s3.sh | 12 ++++----- 5 files changed, 109 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76a5e9a3d79..74c21018c02 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/internal/dnfjson/dnfjson_test.go b/internal/dnfjson/dnfjson_test.go index 67ec0304b67..ed6f310db99 100644 --- a/internal/dnfjson/dnfjson_test.go +++ b/internal/dnfjson/dnfjson_test.go @@ -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 @@ -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{ diff --git a/test/cases/api.sh b/test/cases/api.sh index 2686bb68bd5..7b3f2cbf77d 100755 --- a/test/cases/api.sh +++ b/test/cases/api.sh @@ -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 < "$REQUEST_FILE2" +jq "$jq_edit" "$REQUEST_FILE" > "$REQUEST_FILE2" greenprint "Sending compose: Fail test" sendCompose "$REQUEST_FILE2" diff --git a/test/cases/api/aws.sh b/test/cases/api/aws.sh index d9f882fa92f..beb82d26403 100644 --- a/test/cases/api/aws.sh +++ b/test/cases/api/aws.sh @@ -47,11 +47,11 @@ function createReqFile() { "payload_repositories": [ { "baseurl": "$PAYLOAD_REPO_URL" - } + }${EXTRA_PAYLOAD_REPOS_BLOCK} ], "packages": [ "postgresql", - "dummy" + "dummy"${EXTRA_PACKAGES_BLOCK} ], "users":[ { diff --git a/test/cases/api/common/s3.sh b/test/cases/api/common/s3.sh index 27abfa5bd6e..5d7d7223342 100644 --- a/test/cases/api/common/s3.sh +++ b/test/cases/api/common/s3.sh @@ -21,11 +21,11 @@ function createReqFileEdge() { "payload_repositories": [ { "baseurl": "$PAYLOAD_REPO_URL" - } + }${EXTRA_PAYLOAD_REPOS_BLOCK} ], "packages": [ "postgresql", - "dummy" + "dummy"${EXTRA_PACKAGES_BLOCK} ], "users":[ { @@ -67,11 +67,11 @@ function createReqFileGuest() { "payload_repositories": [ { "baseurl": "$PAYLOAD_REPO_URL" - } + }${EXTRA_PAYLOAD_REPOS_BLOCK} ], "packages": [ "postgresql", - "dummy" + "dummy"${EXTRA_PACKAGES_BLOCK} ], "users":[ { @@ -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} },