Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TFC: Support for test run #1635

Open
2 tasks
Tracked by #1590
radeksimko opened this issue Nov 20, 2023 · 0 comments
Open
2 tasks
Tracked by #1590

TFC: Support for test run #1635

radeksimko opened this issue Nov 20, 2023 · 0 comments
Labels
enhancement New feature or request terraform-cloud Features or bugs related to TFC integration in the editor

Comments

@radeksimko
Copy link
Member

Background

As part of #1590 we introduced support for structured log output, where all kinds of actions (planned_change, resource_drift, outputs, diagnostics) are represented in the UI (tree view):

const logLine: LogLine = JSON.parse(line);
if (logLine.type === 'planned_change' && logLine.change) {
if (!planLog.plannedChanges) {
planLog.plannedChanges = [];
}
planLog.plannedChanges.push(logLine.change);
continue;
}
if (logLine.type === 'resource_drift' && logLine.change) {
if (!planLog.driftChanges) {
planLog.driftChanges = [];
}
if (!planLog.driftSummary) {
planLog.driftSummary = {
changed: 0,
deleted: 0,
};
}
planLog.driftChanges.push(logLine.change);
if (logLine.change.action === 'update') {
planLog.driftSummary.changed += 1;
}
if (logLine.change.action === 'delete') {
planLog.driftSummary.deleted += 1;
}
continue;
}
if (logLine.type === 'change_summary' && logLine.changes) {
planLog.changeSummary = logLine.changes;
continue;
}
if (logLine.type === 'outputs' && logLine.outputs) {
planLog.outputs = logLine.outputs;
continue;
}
if (logLine.type === 'diagnostic' && logLine.diagnostic) {
if (!planLog.diagnostics) {
planLog.diagnostics = [];
}
if (!planLog.diagnosticSummary) {
planLog.diagnosticSummary = {
errorCount: 0,
warningCount: 0,
};
}
planLog.diagnostics.push(logLine.diagnostic);
if (logLine.diagnostic.severity === 'warning') {
planLog.diagnosticSummary.warningCount += 1;
}
if (logLine.diagnostic.severity === 'error') {
planLog.diagnosticSummary.errorCount += 1;
}
continue;
}
// TODO: logLine.type=test_*

In the PR, we decided to omit support for test actions as there's many of them and it would therefore involved non-trivial amount of effort to add the support and understand the context for each action.

Test actions

Proposal

@radeksimko radeksimko added enhancement New feature or request terraform-cloud Features or bugs related to TFC integration in the editor labels Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request terraform-cloud Features or bugs related to TFC integration in the editor
Projects
None yet
Development

No branches or pull requests

1 participant