fix: don't read TIMEOUT for version= label
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Closes coop-cloud/organising#451
This commit is contained in:
parent
8788558cf1
commit
3d1158a425
2
go.mod
2
go.mod
|
@ -41,7 +41,7 @@ require (
|
|||
github.com/prometheus/client_golang v1.16.0 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/spf13/cobra v1.3.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/theupdateframework/notary v0.7.0 // indirect
|
||||
github.com/urfave/cli v1.22.9
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190809123943-df4f5c81cb3b // indirect
|
||||
|
|
|
@ -419,7 +419,7 @@ func GetVersionLabelLocal(recipe Recipe) (string, error) {
|
|||
|
||||
for _, service := range recipe.Config.Services {
|
||||
for label, value := range service.Deploy.Labels {
|
||||
if strings.HasPrefix(label, "coop-cloud") {
|
||||
if strings.HasPrefix(label, "coop-cloud") && strings.Contains(label, "version") {
|
||||
return value, nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package recipe
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetVersionLabelLocalDoesNotUseTimeoutLabel(t *testing.T) {
|
||||
offline := true
|
||||
recipe, err := Get("traefik", offline)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for i := 1; i < 1000; i++ {
|
||||
label, err := GetVersionLabelLocal(recipe)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// NOTE(d1): this is potentially quite a brittle unit test as it needs to
|
||||
// hardcode the default timeout label to ensure that the label parser never
|
||||
// returns it. hopefully this won't fail too often! if you're here because
|
||||
// of a failure, just update the `defaultTimeoutLabel` value & permalink
|
||||
// below
|
||||
// https://git.coopcloud.tech/coop-cloud/traefik/src/commit/ac3a47fe8ca3ef92db84f64cfedfbb348000faee/.env.sample#L2
|
||||
defaultTimeoutLabel := "300"
|
||||
assert.NotEqual(t, label, defaultTimeoutLabel)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue