mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-19 06:30:43 -04:00
cli: Terraform upgrades maa patching (#1821)
* patch maa after upgrade * buildfiles * reword comment * remove whitespace * temp: log measurements URL * temp: update import * ignore changes to attestation policies * add issue URL * separate output in e2e upgrade test * use enterprise CLI for e2e test * remove measurements print * add license headers
This commit is contained in:
parent
7ef7f09dda
commit
8c3b963a3f
10 changed files with 236 additions and 109 deletions
|
@ -164,6 +164,7 @@ func TestApplyTerraformMigrations(t *testing.T) {
|
|||
|
||||
testCases := map[string]struct {
|
||||
tf tfClient
|
||||
policyPatcher stubPolicyPatcher
|
||||
fs file.Handler
|
||||
outputFileName string
|
||||
wantErr bool
|
||||
|
@ -171,6 +172,7 @@ func TestApplyTerraformMigrations(t *testing.T) {
|
|||
"success": {
|
||||
tf: &stubTerraformClient{},
|
||||
fs: fileHandler(),
|
||||
policyPatcher: stubPolicyPatcher{},
|
||||
outputFileName: "test.json",
|
||||
},
|
||||
"create cluster error": {
|
||||
|
@ -178,18 +180,29 @@ func TestApplyTerraformMigrations(t *testing.T) {
|
|||
CreateClusterErr: assert.AnError,
|
||||
},
|
||||
fs: fileHandler(),
|
||||
policyPatcher: stubPolicyPatcher{},
|
||||
outputFileName: "test.json",
|
||||
wantErr: true,
|
||||
},
|
||||
"patch error": {
|
||||
tf: &stubTerraformClient{},
|
||||
fs: fileHandler(),
|
||||
policyPatcher: stubPolicyPatcher{
|
||||
patchErr: assert.AnError,
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
"empty file name": {
|
||||
tf: &stubTerraformClient{},
|
||||
fs: fileHandler(),
|
||||
policyPatcher: stubPolicyPatcher{},
|
||||
outputFileName: "",
|
||||
wantErr: true,
|
||||
},
|
||||
"file already exists": {
|
||||
tf: &stubTerraformClient{},
|
||||
fs: fileHandler("test.json"),
|
||||
policyPatcher: stubPolicyPatcher{},
|
||||
outputFileName: "test.json",
|
||||
wantErr: true,
|
||||
},
|
||||
|
@ -311,3 +324,11 @@ func (u *stubTerraformClient) Plan(context.Context, terraform.LogLevel, string,
|
|||
func (u *stubTerraformClient) CreateCluster(context.Context, terraform.LogLevel, ...string) (terraform.CreateOutput, error) {
|
||||
return terraform.CreateOutput{}, u.CreateClusterErr
|
||||
}
|
||||
|
||||
type stubPolicyPatcher struct {
|
||||
patchErr error
|
||||
}
|
||||
|
||||
func (p *stubPolicyPatcher) PatchPolicy(context.Context, string) error {
|
||||
return p.patchErr
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue