Weldr API: make Image Type denylist distribution-specific
Change the Image Type denylist in Weldr API from being applied to all distributions to being distribution-specific. A special name `*` can be used in the configuration to match any distribution or any image type. Modify NEWS entry and unit tests to reflect this change. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
076bbc5456
commit
b150d57c18
8 changed files with 160 additions and 62 deletions
|
|
@ -36,7 +36,8 @@ func TestConfig(t *testing.T) {
|
|||
require.Equal(t, config.Worker.AllowedDomains, []string{"osbuild.org"})
|
||||
require.Equal(t, config.Worker.CA, "/etc/osbuild-composer/ca-crt.pem")
|
||||
|
||||
require.Equal(t, config.WeldrAPI.ImageTypeDenylist, []string{"qcow2", "vmdk"})
|
||||
require.Equal(t, []string{"qcow2", "vmdk"}, config.WeldrAPI.DistroConfigs["*"].ImageTypeDenyList)
|
||||
require.Equal(t, []string{"qcow2"}, config.WeldrAPI.DistroConfigs["rhel-84"].ImageTypeDenyList)
|
||||
|
||||
require.Equal(t, "overwrite-me-db", config.Worker.PGDatabase)
|
||||
|
||||
|
|
@ -46,3 +47,16 @@ func TestConfig(t *testing.T) {
|
|||
require.NotNil(t, config)
|
||||
require.Equal(t, "composer-db", config.Worker.PGDatabase)
|
||||
}
|
||||
|
||||
func TestWeldrDistrosImageTypeDenyList(t *testing.T) {
|
||||
config, err := LoadConfig("testdata/test.toml")
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, config)
|
||||
|
||||
expectedWeldrDistrosImageTypeDenyList := map[string][]string{
|
||||
"*": {"qcow2", "vmdk"},
|
||||
"rhel-84": {"qcow2"},
|
||||
}
|
||||
|
||||
require.Equal(t, expectedWeldrDistrosImageTypeDenyList, config.weldrDistrosImageTypeDenyList())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue