Skip to content

Commit

Permalink
fix(k8s): ensure sys metadata ns exists for tests
Browse files Browse the repository at this point in the history
When storing or getting test results, ensure that the
`garden-system--metadata` namespace exists.

This fixes an issue when using minikube, where this namespace wouldn't
automatically be created during init, leading to errors when tests were
run.
  • Loading branch information
thsig authored and edvald committed Sep 10, 2019
1 parent e2ade31 commit c88af24
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions garden-service/src/plugins/kubernetes/test-results.ts
Expand Up @@ -21,6 +21,7 @@ import * as hasha from "hasha"
import { gardenAnnotationKey } from "../../util/string"
import { upsertConfigMap } from "./util"
import { trimRunOutput } from "./helm/common"
import { ensureNamespace } from "./namespace"

const testResultNamespace = systemMetadataNamespace

Expand All @@ -29,6 +30,7 @@ export async function getTestResult(
): Promise<TestResult | null> {
const k8sCtx = <KubernetesPluginContext>ctx
const api = await KubeApi.factory(log, k8sCtx.provider)
await ensureNamespace(api, testResultNamespace)
const resultKey = getTestResultKey(k8sCtx, module, testName, testVersion)

try {
Expand Down Expand Up @@ -83,6 +85,7 @@ export async function storeTestResult(
): Promise<TestResult> {
const k8sCtx = <KubernetesPluginContext>ctx
const api = await KubeApi.factory(log, k8sCtx.provider)
await ensureNamespace(api, testResultNamespace)

const data: TestResult = trimRunOutput(result)

Expand Down

0 comments on commit c88af24

Please sign in to comment.