Skip to content

Commit

Permalink
Skip acceptance test if lifecycle doesn't support customizing creatio…
Browse files Browse the repository at this point in the history
…n time

Signed-off-by: Natalie Arellano <narellano@vmware.com>
  • Loading branch information
natalieparellano committed Apr 13, 2022
1 parent 34ff550 commit 26c6f36
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,7 @@ include = [ "*.jar", "media/mountain.jpg", "/media/person.png", ]
when("--creation-time", func() {
it.Before(func() {
h.SkipIf(t, !pack.SupportsFeature(invoke.CreationTime), "")
h.SkipIf(t, !lifecycle.SupportsFeature(config.CreationTime), "")
})

when("provided as 'now'", func() {
Expand Down
18 changes: 17 additions & 1 deletion acceptance/config/lifecycle_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,23 @@ func (l *LifecycleAsset) JSONOutputForAPIs(baseIndentationWidth int) (

type LifecycleFeature int

var lifecycleFeatureTests = map[LifecycleFeature]func(l *LifecycleAsset) bool{}
const CreationTime = iota

var lifecycleFeatureTests = map[LifecycleFeature]func(l *LifecycleAsset) bool{
CreationTime: func(i *LifecycleAsset) bool {
for _, platformAPI := range i.descriptor.APIs.Platform.Supported {
if platformAPI.AtLeast("0.9") {
return true
}
}
for _, platformAPI := range i.descriptor.APIs.Platform.Deprecated {
if platformAPI.AtLeast("0.9") {
return true
}
}
return false
},
}

func (l *LifecycleAsset) SupportsFeature(f LifecycleFeature) bool {
return lifecycleFeatureTests[f](l)
Expand Down

0 comments on commit 26c6f36

Please sign in to comment.