MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / TestStringFormat

Function TestStringFormat

internal/feature/features_test.go:31–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestStringFormat(t *testing.T) {
32 t.Parallel()
33 gate := NewGate()
34
35 assert.NilError(t, gate.Set(""))
36 assert.NilError(t, gate.Set("TablespaceVolumes=true"))
37 assert.Assert(t, true == gate.Enabled(TablespaceVolumes))
38
39 err := gate.Set("NotAGate=true")
40 assert.ErrorContains(t, err, "unrecognized feature gate")
41 assert.ErrorContains(t, err, "NotAGate")
42
43 err = gate.Set("GateNotSet")
44 assert.ErrorContains(t, err, "missing bool")
45 assert.ErrorContains(t, err, "GateNotSet")
46
47 err = gate.Set("GateNotSet=foo")
48 assert.ErrorContains(t, err, "invalid value")
49 assert.ErrorContains(t, err, "GateNotSet")
50}
51
52func TestContext(t *testing.T) {
53 t.Parallel()

Callers

nothing calls this directly

Calls 3

EnabledMethod · 0.95
NewGateFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected