@ -25,31 +27,23 @@ const name string = "HELM_EXPERIMENTAL_FEATURE"
funcTestIsEnabled(t*testing.T){
g:=Gate(name)
ifg.IsEnabled(){
t.Errorf("feature gate shows as available, but the environment variable %s was not set",name)
}
assert.False(t,g.IsEnabled(),"feature gate shows as available, but the environment variable %s was not set",name)
t.Setenv(name,"1")
if!g.IsEnabled(){
t.Errorf("feature gate shows as disabled, but the environment variable %s was set",name)
}
assert.True(t,g.IsEnabled(),"feature gate shows as disabled, but the environment variable %s was set",name)
}
funcTestError(t*testing.T){
os.Unsetenv(name)
g:=Gate(name)
ifg.Error().Error()!="this feature has been marked as experimental and is not enabled by default. Please set HELM_EXPERIMENTAL_FEATURE=1 in your environment to use this feature"{
t.Errorf("incorrect error message. Received %s",g.Error().Error())
}
assert.Equal(t,"this feature has been marked as experimental and is not enabled by default. Please set HELM_EXPERIMENTAL_FEATURE=1 in your environment to use this feature",g.Error().Error())
}
funcTestString(t*testing.T){
os.Unsetenv(name)
g:=Gate(name)
ifg.String()!="HELM_EXPERIMENTAL_FEATURE"{
t.Errorf("incorrect string representation. Received %s",g.String())
require.NoError(t,err,"%s annotation with value '%s' not in RFC3339 format",ocispec.AnnotationCreated,result[ocispec.AnnotationCreated])
// Verify creation annotation after time test began
if!nowTime.Before(createdTimeAnnotation){
t.Errorf("%s annotation with value '%s' not configured properly. Annotation value is not after %s",ocispec.AnnotationCreated,result[ocispec.AnnotationCreated],nowTimeString)
}
}
// Verify creation annotation after (or equals) time test began
assert.False(t,nowTime.Before(createdTimeAnnotation),"%s annotation with value '%s' not configured properly. Annotation value is not after %s",ocispec.AnnotationCreated,result[ocispec.AnnotationCreated],nowTimeString)