0
0
forked from toolshed/abra

fix: don't read TIMEOUT for version= label

Closes coop-cloud/organising#451
This commit is contained in:
2023-09-21 11:33:45 +02:00
parent 8788558cf1
commit 3d1158a425
3 changed files with 33 additions and 2 deletions

31
pkg/recipe/recipe_test.go Normal file
View File

@ -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)
}
}