Skip to content

Commit

Permalink
Use JSON encoding in TestStateMachine setup and clean useless test
Browse files Browse the repository at this point in the history
  • Loading branch information
upils committed Sep 19, 2023
1 parent 90b7520 commit 8a811b7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions internal/statemachine/state_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (TestStateMachine *testStateMachine) Setup() error {
}

// if --resume was passed, figure out where to start
if err := TestStateMachine.readMetadataGob(); err != nil {
if err := TestStateMachine.readMetadataJSON(metadataStateFile); err != nil {
return err
}

Expand Down Expand Up @@ -438,21 +438,6 @@ func TestSetCommonOpts(t *testing.T) {
})
}

// TestFailedMetadataParse tests a failure in parsing the metadata file. This is accomplished
// by giving the state machine a syntactically invalid metadata file to parse
func TestFailedMetadataParse(t *testing.T) {
t.Run("test_failed_metadata_parse", func(t *testing.T) {
asserter := helper.Asserter{T: t}
var stateMachine StateMachine
stateMachine.commonFlags, stateMachine.stateMachineFlags = helper.InitCommonOpts()
stateMachine.stateMachineFlags.Resume = true
stateMachine.stateMachineFlags.WorkDir = "testdata"

err := stateMachine.readMetadataGob()
asserter.AssertErrContains(err, "failed to parse metadata file")
})
}

// TestParseImageSizes tests a successful image size parse with all of the different allowed syntaxes
func TestParseImageSizes(t *testing.T) {
testCases := []struct {
Expand Down
Binary file removed internal/statemachine/testdata/ubuntu-image.gob
Binary file not shown.

0 comments on commit 8a811b7

Please sign in to comment.