(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestContext(t *testing.T) { |
| 53 | t.Parallel() |
| 54 | gate := NewGate() |
| 55 | ctx := NewContext(context.Background(), gate) |
| 56 | |
| 57 | assert.Equal(t, ShowAssigned(ctx), "") |
| 58 | assert.Assert(t, ShowEnabled(ctx) != "") // This assumes some feature is enabled by default. |
| 59 | |
| 60 | assert.NilError(t, gate.Set("TablespaceVolumes=true")) |
| 61 | assert.Assert(t, Enabled(ctx, TablespaceVolumes)) |
| 62 | assert.Equal(t, ShowAssigned(ctx), "TablespaceVolumes=true") |
| 63 | assert.Assert(t, |
| 64 | strings.Contains(ShowEnabled(ctx), "TablespaceVolumes=true"), |
| 65 | "got: %v", ShowEnabled(ctx)) |
| 66 | |
| 67 | assert.NilError(t, gate.SetFromMap(map[string]bool{TablespaceVolumes: false})) |
| 68 | assert.Assert(t, !Enabled(ctx, TablespaceVolumes)) |
| 69 | assert.Equal(t, ShowAssigned(ctx), "TablespaceVolumes=false") |
| 70 | assert.Assert(t, |
| 71 | !strings.Contains(ShowEnabled(ctx), "TablespaceVolumes"), |
| 72 | "got: %v", ShowEnabled(ctx)) |
| 73 | } |
nothing calls this directly
no test coverage detected