mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 14:26:23 -04:00
cli: write infrastructure to new state file (#2321)
Co-authored-by: 3u13r <lc@edgeless.systems>
This commit is contained in:
parent
8f5a2867b4
commit
322c4aad10
26 changed files with 263 additions and 109 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/edgelesssys/constellation/v2/cli/internal/clusterid"
|
||||
"github.com/edgelesssys/constellation/v2/cli/internal/helm"
|
||||
"github.com/edgelesssys/constellation/v2/cli/internal/kubecmd"
|
||||
"github.com/edgelesssys/constellation/v2/cli/internal/state"
|
||||
"github.com/edgelesssys/constellation/v2/cli/internal/terraform"
|
||||
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
|
||||
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
||||
|
@ -186,7 +187,7 @@ func TestUpgradeApply(t *testing.T) {
|
|||
clusterUpgrader: tc.terraformUpgrader,
|
||||
log: logger.NewTest(t),
|
||||
configFetcher: stubAttestationFetcher{},
|
||||
clusterShower: &stubShowCluster{},
|
||||
clusterShower: &stubShowInfrastructure{},
|
||||
fileHandler: handler,
|
||||
}
|
||||
|
||||
|
@ -198,6 +199,15 @@ func TestUpgradeApply(t *testing.T) {
|
|||
assert.NoError(err)
|
||||
assert.Equal(!tc.flags.skipPhases.contains(skipImagePhase), tc.kubeUpgrader.calledNodeUpgrade,
|
||||
"incorrect node upgrade skipping behavior")
|
||||
|
||||
var gotState state.State
|
||||
expectedState := state.Infrastructure{
|
||||
APIServerCertSANs: []string{},
|
||||
Azure: &state.Azure{},
|
||||
}
|
||||
require.NoError(handler.ReadYAML(constants.StateFilename, &gotState))
|
||||
assert.Equal("v1", gotState.Version)
|
||||
assert.Equal(expectedState, gotState.Infrastructure)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +308,9 @@ type mockApplier struct {
|
|||
mock.Mock
|
||||
}
|
||||
|
||||
func (m *mockApplier) PrepareApply(cfg *config.Config, clusterID clusterid.File, helmOpts helm.Options, terraformOut terraform.ApplyOutput, str string, masterSecret uri.MasterSecret) (helm.Applier, bool, error) {
|
||||
args := m.Called(cfg, clusterID, helmOpts, terraformOut, str, masterSecret)
|
||||
func (m *mockApplier) PrepareApply(cfg *config.Config, clusterID clusterid.File,
|
||||
helmOpts helm.Options, infraState state.Infrastructure, str string, masterSecret uri.MasterSecret,
|
||||
) (helm.Applier, bool, error) {
|
||||
args := m.Called(cfg, clusterID, helmOpts, infraState, str, masterSecret)
|
||||
return args.Get(0).(helm.Applier), args.Bool(1), args.Error(2)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue