mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-12-15 16:09:39 -05:00
AB#2094 cloud provider specific configs (#151)
add argument to generate cloud specific configuration file
This commit is contained in:
parent
54e2e492df
commit
7c2d1c3490
5 changed files with 113 additions and 12 deletions
|
|
@ -3,6 +3,7 @@ package config
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/edgelesssys/constellation/cli/cloudprovider"
|
||||
"github.com/edgelesssys/constellation/internal/constants"
|
||||
"github.com/edgelesssys/constellation/internal/file"
|
||||
"github.com/spf13/afero"
|
||||
|
|
@ -92,3 +93,44 @@ func TestFromFile(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigRemoveProviderExcept(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
removeExcept cloudprovider.Provider
|
||||
wantAzure *AzureConfig
|
||||
wantGCP *GCPConfig
|
||||
wantQEMU *QEMUConfig
|
||||
}{
|
||||
"except azure": {
|
||||
removeExcept: cloudprovider.Azure,
|
||||
wantAzure: Default().Provider.Azure,
|
||||
},
|
||||
"except gcp": {
|
||||
removeExcept: cloudprovider.GCP,
|
||||
wantGCP: Default().Provider.GCP,
|
||||
},
|
||||
"except qemu": {
|
||||
removeExcept: cloudprovider.QEMU,
|
||||
wantQEMU: Default().Provider.QEMU,
|
||||
},
|
||||
"unknown provider": {
|
||||
removeExcept: cloudprovider.Unknown,
|
||||
wantAzure: Default().Provider.Azure,
|
||||
wantGCP: Default().Provider.GCP,
|
||||
wantQEMU: Default().Provider.QEMU,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
conf := Default()
|
||||
conf.RemoveProviderExcept(tc.removeExcept)
|
||||
|
||||
assert.Equal(tc.wantAzure, conf.Provider.Azure)
|
||||
assert.Equal(tc.wantGCP, conf.Provider.GCP)
|
||||
assert.Equal(tc.wantQEMU, conf.Provider.QEMU)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue