diff --git a/internal/client/blueprints_test.go b/internal/client/blueprints_test.go index 8cfa9a7be4d..028ca0f9fb9 100644 --- a/internal/client/blueprints_test.go +++ b/internal/client/blueprints_test.go @@ -1006,6 +1006,70 @@ func TestBlueprintDepsolveGlobsV0(t *testing.T) { assert.True(t, common.IsStringInSortedSlice(names, "tmux")) } +// depsolve a blueprint with package from 3rd party with module_hotfixes +func TestBlueprintDepsolveModuleHotfixesErrorV0(t *testing.T) { + // Depends on real packages, only run as an integration test + if testState.unitTest { + t.Skip() + } + bp := `{ + "name": "test-deps-blueprint-module-hotfixes-error-v0", + "description": "CheckBlueprintDepsolveModuleHotfixesErrorV0", + "version": "0.0.1", + "packages": [{"name": "nginx", "version": "*"}, + {"name": "nginx-module-njs", "version": "*"}], + "customizations": {"repositories": [ + {"id": "nginx", "module_hotfixes": false, + "baseurls": ["https://rpmrepo.osbuild.org/v2/mirror/public/el8/el8-x86_64-nginx-20231207"], + "gpgcheck": false, "check_repo_gpg": false} + ]} + }` + + // Push a blueprint + resp, err := PostJSONBlueprintV0(testState.socket, bp) + require.NoError(t, err, "POST blueprint failed with a client error") + require.True(t, resp.Status, "POST blueprint failed: %#v", resp) + + // Depsolve the blueprint + deps, api, err := DepsolveBlueprintV0(testState.socket, "test-deps-blueprint-module-hotfixes-error-v0") + require.NoError(t, err, "Depsolve blueprint failed with a client error") + require.Nil(t, api, "DepsolveBlueprint failed: %#v", api) + require.Greater(t, len(deps.Errors), 0, "Errors occurred during depsolving") +} + +// depsolve a blueprint with package from 3rd party with module_hotfixes +func TestBlueprintDepsolveModuleHotfixesV0(t *testing.T) { + // Depends on real packages, only run as an integration test + if testState.unitTest { + t.Skip() + } + bp := `{ + "name": "test-deps-blueprint-module-hotfixes-v0", + "description": "CheckBlueprintDepsolveModuleHotfixesV0", + "version": "0.0.1", + "packages": [{"name": "nginx", "version": "*"}, + {"name": "nginx-module-njs", "version": "*"}], + "customizations": {"repositories": [ + {"id": "nginx", "module_hotfixes": true, + "baseurls": ["https://rpmrepo.osbuild.org/v2/mirror/public/el8/el8-x86_64-nginx-20231207"], + "gpgcheck": false, "check_repo_gpg": false} + ]} + }` + + // Push a blueprint + resp, err := PostJSONBlueprintV0(testState.socket, bp) + require.NoError(t, err, "POST blueprint failed with a client error") + require.True(t, resp.Status, "POST blueprint failed: %#v", resp) + + // Depsolve the blueprint + deps, api, err := DepsolveBlueprintV0(testState.socket, "test-deps-blueprint-module-hotfixes-v0") + require.NoError(t, err, "Depsolve blueprint failed with a client error") + require.Nil(t, api, "DepsolveBlueprint failed: %#v", api) + t.Log(deps.Errors[0].Msg) + require.Equal(t, 0, len(deps.Errors), "Errors occurred during depsolving") + require.Greater(t, len(deps.Blueprints), 0, "No blueprint dependencies returned") +} + // depsolve a non-existent blueprint func TestNonBlueprintDepsolveV0(t *testing.T) { resp, api, err := DepsolveBlueprintV0(testState.socket, "test-deps-non-blueprint-v0")