(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestNamespaceFromEnv(t *testing.T) { |
| 49 | ctx := context.Background() |
| 50 | namespace, ok := Namespace(ctx) |
| 51 | if ok { |
| 52 | t.Fatal("namespace should not be present") |
| 53 | } |
| 54 | |
| 55 | if namespace != "" { |
| 56 | t.Fatalf("namespace should not be defined: got %q", namespace) |
| 57 | } |
| 58 | |
| 59 | expected := "test-namespace" |
| 60 | t.Setenv(NamespaceEnvVar, expected) |
| 61 | nctx := NamespaceFromEnv(ctx) |
| 62 | |
| 63 | namespace, ok = Namespace(nctx) |
| 64 | if !ok { |
| 65 | t.Fatal("expected to find a namespace") |
| 66 | } |
| 67 | |
| 68 | if namespace != expected { |
| 69 | t.Fatalf("unexpected namespace: %q != %q", namespace, expected) |
| 70 | } |
| 71 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…