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:
Moritz Sanft 2023-06-02 10:47:44 +02:00 committed by GitHub
parent 7ef7f09dda
commit 8c3b963a3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 236 additions and 109 deletions

View file

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