test: Add nginx to the image request

This commit is contained in:
Ondrej Ezr 2023-12-07 13:30:16 +01:00 committed by Tomáš Hozza
parent 4b3b942dde
commit d5483ccfb0
5 changed files with 124 additions and 10 deletions

View file

@ -534,6 +534,32 @@ 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
- /usr/libexec/tests/osbuild-composer/api.sh "${IMAGE_TYPE}" "" "${TEST_MODULE_HOTFIXES}"
parallel:
matrix:
- IMAGE_TYPE:
- aws
RUNNER:
- aws/rhel-8.8-ga-x86_64
- aws/rhel-8.8-ga-aarch64
INTERNAL_NETWORK: ["true"]
TEST_MODULE_HOTFIXES: [1]
- IMAGE_TYPE:
- vsphere
RUNNER:
- aws/rhel-8.8-ga-x86_64
INTERNAL_NETWORK: ["true"]
TEST_MODULE_HOTFIXES: [1]
.libvirt_integration:
stage: test
extends: .terraform/gcp

View file

@ -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{

View file

@ -33,8 +33,8 @@ export IMAGE_TYPE_OCI="oci"
export IMAGE_TYPE_VSPHERE="vsphere"
export IMAGE_TYPE_IOT_COMMIT="iot-commit"
if (( $# > 2 )); then
echo "$0 does not support more than two arguments"
if (( $# > 3 )); then
echo "$0 does not support more than three arguments"
exit 1
fi
@ -46,6 +46,7 @@ fi
set -euo pipefail
IMAGE_TYPE="$1"
TEST_MODULE_HOTFIXES="${3:-0}"
# select cloud provider based on image type
#
@ -438,6 +439,39 @@ 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
)
else
EXTRA_PAYLOAD_REPOS_BLOCK=""
EXTRA_PACKAGES_BLOCK=""
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 ""
@ -582,7 +616,9 @@ function waitForImgState() {
#
# Make sure that requesting a non existing paquet results in failure
# and if TEST_MODULE_HOTFIXES flag is passed, we verify, that without that flag the resolve fails
#
REQUEST_FILE2="${WORKDIR}/request2.json"
jq '.customizations.packages = [ "jesuisunpaquetquinexistepas" ]' "$REQUEST_FILE" > "$REQUEST_FILE2"
@ -590,6 +626,15 @@ greenprint "Sending compose: Fail test"
sendCompose "$REQUEST_FILE2"
waitForState "failure"
if [ "$TEST_MODULE_HOTFIXES" = "1" ]; then
cat "$REQUEST_FILE"
jq 'del(.customizations.payload_repositories[] | select(.baseurl | match(".*public/el8/el8-.*-nginx-.*")) | .module_hotfixes)' "$REQUEST_FILE" > "$REQUEST_FILE2"
greenprint "Sending compose: Fail depsolve test"
sendCompose "$REQUEST_FILE2"
waitForState "failure"
fi
# crashed/stopped/killed worker should result in the job being retried
greenprint "Sending compose: Retry test"
sendCompose "$REQUEST_FILE"

View file

@ -47,11 +47,11 @@ function createReqFile() {
"payload_repositories": [
{
"baseurl": "$PAYLOAD_REPO_URL"
}
}${EXTRA_PAYLOAD_REPOS_BLOCK}
],
"packages": [
"postgresql",
"dummy"
"dummy"${EXTRA_PACKAGES_BLOCK}
],
"users":[
{

View file

@ -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}
},