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

Add ability to parse presanitized text #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

scgodbold
Copy link

This is in reference to #23 I opened earlier this week. I had some free time and figured I would take a stab at it. It attempts to add the ability to parse pre-sanitized input such as what terraform show provides. This helps enable use in automation as it is best to store your plan objects to assure a consistent apply occurs.

The idea being that passing a --clean flag to the parser tells it that only resource changes will be listed. Doing this there is no need to substring the plan to extract the changing resources.

@coveralls
Copy link

coveralls commented Dec 21, 2018

Pull Request Test Coverage Report for Build 112

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 103: 0.0%
Covered Lines: 171
Relevant Lines: 171

💛 - Coveralls

}

async function runTest (dataName: string, t: any) {
const actual = await readActual(dataName);
const actual = await readActual(dataName, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small improvement, but how would feel about simply adding the clean: boolean parameter to runTest and pass it through as needed. That would avoid the need for a separate runCleanTest function which duplicates most of its logic.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me, I actually debated doing it that way when I started looking at testing. I will give the other reviewers a chance to take a peak and then update my change based on all the feedback. 😄

@Druotic
Copy link
Contributor

Druotic commented Jan 8, 2019

Thanks for the contribution @scgodbold! Overall, this looks great to me and your use-case sounds like a valid case to me. Just a minor comment on the test helpers. I'll add a couple of other reviewers so we can get this merged soon.

Scott Godbold added 3 commits January 10, 2019 12:54
Rebased commit to upstream since changes had occured, and addressed
issues in previous commit.
mdlavin
mdlavin previously approved these changes Feb 10, 2019
Copy link
Member

@mdlavin mdlavin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me @philidem you have thought about this code more than I have. Want to merge it?

Druotic
Druotic previously approved these changes Feb 11, 2019
Copy link
Contributor

@philidem philidem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a clean: boolean argument, please use a options?: ParseOptions argument.

src/index.ts Outdated
@@ -347,7 +348,7 @@ function parseAttributeLine (line: string, lastChange: Changed, errors: Array<Pa
lastChange.changedAttributes[name] = result;
}

export function parseStdout (logOutput: string): ParseResult {
export function parseStdout (logOutput: string, clean: boolean): ParseResult {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this to an options argument that has a clean property? I'm worried that additional options will be added in the future and it will be hard to prevent breaking change if we don't provide this flexibility now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, make the second options argument optional. For example, something like:

function parseStdout (logOutput: string, options?: ParseOptions): ParseResult {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, I was off on a vacation I will get going on making these changes 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all be fixed

@joedimarzio joedimarzio dismissed stale reviews from Druotic and mdlavin via caba224 August 4, 2021 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants