Skip to content

Commit

Permalink
fix: set log state to success after deleting env
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 committed Nov 6, 2018
1 parent 8e813e9 commit 19ef038
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions garden-service/src/logger/log-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface UpdateOpts {
showDuration?: boolean
error?: GardenError
status?: EntryStatus
indentationLevel?: number
indent?: number
}

export interface CreateOpts extends UpdateOpts {
Expand Down Expand Up @@ -103,12 +103,12 @@ export class LogEntry extends LogNode {

createNode(level: LogLevel, parent: LogNode, param?: CreateParam) {
// Empty entries inherit their parent's indentation level
let { indentationLevel } = this.opts
let { indent } = this.opts
if (param) {
indentationLevel = (indentationLevel || 0) + 1
indent = (indent || 0) + 1
}
const opts = {
indentationLevel,
indent,
...resolveParam(param),
}
return new LogEntry({ level, opts, parent })
Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/logger/renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function printEmoji(emoji: EmojiName) {

/*** RENDERERS ***/
export function leftPad(entry: LogEntry): string {
return padStart("", (entry.opts.indentationLevel || 0) * 3)
return padStart("", (entry.opts.indent || 0) * 3)
}

export function renderEmoji(entry: LogEntry): string {
Expand Down
2 changes: 2 additions & 0 deletions garden-service/src/plugins/kubernetes/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ export async function cleanupEnvironment({ ctx, logEntry }: CleanupEnvironmentPa
throw new NotFoundError(err, { namespace, availableNamespaces })
}

entry && entry.setSuccess()

await logout({ ctx, logEntry })

// Wait until namespace has been deleted
Expand Down
8 changes: 4 additions & 4 deletions garden-service/test/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@ describe("LogEntry", () => {
const deepDeepNested = deepNested.info("deep deep inside")
const deepDeepEmpty = deepDeepNested.info()
const indentations = [
nested.opts.indentationLevel,
deepNested.opts.indentationLevel,
deepDeepNested.opts.indentationLevel,
deepDeepEmpty.opts.indentationLevel,
nested.opts.indent,
deepNested.opts.indent,
deepDeepNested.opts.indent,
deepDeepEmpty.opts.indent,
]
expect(indentations).to.eql([1, 2, 3, 3])
})
Expand Down

0 comments on commit 19ef038

Please sign in to comment.