Skip to content

Commit

Permalink
Merge pull request GoogleContainerTools#1383 from dgageot/improve-sch…
Browse files Browse the repository at this point in the history
…ema-upgrade-tests

Improve schema upgrade tests
  • Loading branch information
priyawadhwa authored Dec 12, 2018
2 parents be21312 + 383d60a commit dd8ffa4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 13 deletions.
3 changes: 1 addition & 2 deletions pkg/skaffold/schema/v1alpha1/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ deploy:
func verityUpgrade(t *testing.T, input, output string) {
pipeline := NewSkaffoldPipeline()
err := yaml.UnmarshalStrict([]byte(input), pipeline)
testutil.CheckError(t, false, err)
testutil.CheckErrorAndDeepEqual(t, false, err, Version, pipeline.GetVersion())

upgraded, err := pipeline.Upgrade()
testutil.CheckError(t, false, err)

expected := v1alpha2.NewSkaffoldPipeline()
err = yaml.UnmarshalStrict([]byte(output), expected)
testutil.CheckError(t, false, err)

testutil.CheckErrorAndDeepEqual(t, false, err, expected, upgraded)
}
3 changes: 1 addition & 2 deletions pkg/skaffold/schema/v1alpha2/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,13 @@ profiles:
func verityUpgrade(t *testing.T, input, output string) {
pipeline := NewSkaffoldPipeline()
err := yaml.UnmarshalStrict([]byte(input), pipeline)
testutil.CheckError(t, false, err)
testutil.CheckErrorAndDeepEqual(t, false, err, Version, pipeline.GetVersion())

upgraded, err := pipeline.Upgrade()
testutil.CheckError(t, false, err)

expected := v1alpha3.NewSkaffoldPipeline()
err = yaml.UnmarshalStrict([]byte(output), expected)
testutil.CheckError(t, false, err)

testutil.CheckErrorAndDeepEqual(t, false, err, expected, upgraded)
}
3 changes: 1 addition & 2 deletions pkg/skaffold/schema/v1alpha3/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,13 @@ profiles:
func verityUpgrade(t *testing.T, input, output string) {
pipeline := NewSkaffoldPipeline()
err := yaml.UnmarshalStrict([]byte(input), pipeline)
testutil.CheckError(t, false, err)
testutil.CheckErrorAndDeepEqual(t, false, err, Version, pipeline.GetVersion())

upgraded, err := pipeline.Upgrade()
testutil.CheckError(t, false, err)

expected := v1alpha4.NewSkaffoldPipeline()
err = yaml.UnmarshalStrict([]byte(output), expected)
testutil.CheckError(t, false, err)

testutil.CheckErrorAndDeepEqual(t, false, err, expected, upgraded)
}
3 changes: 1 addition & 2 deletions pkg/skaffold/schema/v1alpha4/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,13 @@ profiles:
func verityUpgrade(t *testing.T, input, output string) {
pipeline := NewSkaffoldPipeline()
err := yaml.UnmarshalStrict([]byte(input), pipeline)
testutil.CheckError(t, false, err)
testutil.CheckErrorAndDeepEqual(t, false, err, Version, pipeline.GetVersion())

upgraded, err := pipeline.Upgrade()
testutil.CheckError(t, false, err)

expected := v1alpha5.NewSkaffoldPipeline()
err = yaml.UnmarshalStrict([]byte(output), expected)
testutil.CheckError(t, false, err)

testutil.CheckErrorAndDeepEqual(t, false, err, expected, upgraded)
}
5 changes: 2 additions & 3 deletions pkg/skaffold/schema/v1alpha5/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ profiles:
func upgradeShouldFailt(t *testing.T, input string) {
pipeline := NewSkaffoldPipeline()
err := yaml.UnmarshalStrict([]byte(input), pipeline)
testutil.CheckError(t, false, err)
testutil.CheckErrorAndDeepEqual(t, false, err, Version, pipeline.GetVersion())

_, err = pipeline.Upgrade()
testutil.CheckError(t, true, err)
Expand All @@ -127,14 +127,13 @@ func upgradeShouldFailt(t *testing.T, input string) {
func verityUpgrade(t *testing.T, input, output string) {
pipeline := NewSkaffoldPipeline()
err := yaml.UnmarshalStrict([]byte(input), pipeline)
testutil.CheckError(t, false, err)
testutil.CheckErrorAndDeepEqual(t, false, err, Version, pipeline.GetVersion())

upgraded, err := pipeline.Upgrade()
testutil.CheckError(t, false, err)

expected := v1beta1.NewSkaffoldPipeline()
err = yaml.UnmarshalStrict([]byte(output), expected)
testutil.CheckError(t, false, err)

testutil.CheckErrorAndDeepEqual(t, false, err, expected, upgraded)
}
3 changes: 1 addition & 2 deletions pkg/skaffold/schema/v1beta1/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ profiles:
func verityUpgrade(t *testing.T, input, output string) {
pipeline := NewSkaffoldPipeline()
err := yaml.UnmarshalStrict([]byte(input), pipeline)
testutil.CheckError(t, false, err)
testutil.CheckErrorAndDeepEqual(t, false, err, Version, pipeline.GetVersion())

upgraded, err := pipeline.Upgrade()
testutil.CheckError(t, false, err)

expected := latest.NewSkaffoldPipeline()
err = yaml.UnmarshalStrict([]byte(output), expected)
testutil.CheckError(t, false, err)

testutil.CheckErrorAndDeepEqual(t, false, err, expected, upgraded)
}

0 comments on commit dd8ffa4

Please sign in to comment.