Skip to content

Commit

Permalink
Merge pull request #634 from garden-io/integ-remove-dot-garden-dirs
Browse files Browse the repository at this point in the history
fix(integ-tests): helper to remove .garden dirs
  • Loading branch information
thsig authored Mar 18, 2019
2 parents 1b74573 + 77abbe3 commit d09e454
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions garden-service/test/integ-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import * as execa from "execa"
import * as Bluebird from "bluebird"
import { remove } from "fs-extra"
import { get, intersection } from "lodash"
import { resolve } from "path"
import { GARDEN_DIR_NAME } from "../src/constants"
import { KubeApi } from "../src/plugins/kubernetes/api"
import { deleteNamespaces } from "../src/plugins/kubernetes/init"
import { TaskLogStatus } from "../src/logger/log-entry"
Expand All @@ -8,6 +12,12 @@ import { getAllNamespaces } from "../src/plugins/kubernetes/namespace"
import { getExampleProjects } from "./helpers"
import { WatchTestConditionState } from "./run-garden"

export async function removeExampleDotGardenDirs() {
await Bluebird.map(Object.values(getExampleProjects()), (projectRoot) => {
return remove(resolve(projectRoot, GARDEN_DIR_NAME))
})
}

export async function deleteExampleNamespaces(includeSystemNamespaces = false) {
const namespacesToDelete: string[] = []

Expand Down
5 changes: 3 additions & 2 deletions garden-service/test/integ/src/pre-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
runGarden,
taskCompletedStep,
} from "../../run-garden"
import { deleteExampleNamespaces, searchLog } from "../../integ-helpers"
import { deleteExampleNamespaces, searchLog, removeExampleDotGardenDirs } from "../../integ-helpers"

// TODO: Add test for verifying that CLI returns with an error when called with an unknown command

Expand All @@ -21,8 +21,9 @@ describe("PreReleaseTests", () => {
const simpleProjectPath = resolve(examplesDir, "simple-project")

before(async () => {
mlog.log("deleting example project namespaces")
mlog.log("deleting example project namespaces and .garden folders")
await deleteExampleNamespaces(false)
await removeExampleDotGardenDirs()
})

after(async () => {
Expand Down

0 comments on commit d09e454

Please sign in to comment.