GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — func/cmd/deploy_scale_warn_test.go at main · stackbuilders/func Expand file tree/ Copy pathdeploy_scale_warn_test.goMore file actions 44 lines (38 loc) · 1.24 KB / Copy pathdeploy_scale_warn_test.goFile metadata and controls44 lines (38 loc) · 1.24 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 package cmd import ( "bytes" "strings" "testing" "knative.dev/pkg/ptr" fn "knative.dev/func/pkg/functions" ) // TestWarnScaleKpaIgnore verifies that scale.kpa on a deployer that ignores it // (raw/keda) produces a warning, while the knative and default deployers -- and // a function without scale.kpa -- stay silent. func TestWarnScaleKpaIgnore(t *testing.T) { kpa := &fn.ScaleOptions{KPA: &fn.KPAScaleOptions{Metric: ptr.String("concurrency")}} minOnly := &fn.ScaleOptions{Min: ptr.Int64(1)} tests := []struct { name string scale *fn.ScaleOptions deployer string warn bool }{ {"kpa on raw warns", kpa, "raw", true}, {"kpa on keda warns", kpa, "keda", true}, {"kpa on knative is silent", kpa, "knative", false}, {"kpa on default (empty) deployer is silent", kpa, "", false}, {"no kpa is silent on raw", minOnly, "raw", false}, {"nil scale is silent", nil, "raw", false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var buf bytes.Buffer warnScaleKpaIgnore(&buf, tt.scale, tt.deployer) warned := strings.Contains(buf.String(), "scale.kpa is ignored") if warned != tt.warn { t.Errorf("warnScaleKpaIgnore() warned=%v, want %v (output: %q)", warned, tt.warn, buf.String()) } }) } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |