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 test coverage #78

Merged
merged 4 commits into from
Oct 14, 2024
Merged

Add test coverage #78

merged 4 commits into from
Oct 14, 2024

Conversation

kumdeepakgit
Copy link
Contributor

@kumdeepakgit kumdeepakgit commented Oct 8, 2024

Add test coverage for writer pkg

        github.com/dineshba/tf-summarize/reader         coverage: 0.0% of statements
=== RUN   TestVersionArg
=== RUN   TestVersionArg/when_tf-summarize_is_passed_'-v'
--- PASS: TestVersionArg (0.00s)
    --- PASS: TestVersionArg/when_tf-summarize_is_passed_'-v' (0.00s)
=== RUN   TestTFSummarize
=== RUN   TestTFSummarize/when_tf-summarize_is_passed_'"./tf-summarize-test_-md_example/tfplan.json"'
=== RUN   TestTFSummarize/when_tf-summarize_is_passed_'"cat_example/tfplan.json_|_./tf-summarize-test_-md"'
=== RUN   TestTFSummarize/when_tf-summarize_is_passed_'"cat_example/tfplan.json_|_./tf-summarize-test_-html"'
=== RUN   TestTFSummarize/when_tf-summarize_is_passed_'"cat_example/tfplan.json_|_./tf-summarize-test_-md_-html"'
--- PASS: TestTFSummarize (0.02s)
    --- PASS: TestTFSummarize/when_tf-summarize_is_passed_'"./tf-summarize-test_-md_example/tfplan.json"' (0.00s)
    --- PASS: TestTFSummarize/when_tf-summarize_is_passed_'"cat_example/tfplan.json_|_./tf-summarize-test_-md"' (0.00s)
    --- PASS: TestTFSummarize/when_tf-summarize_is_passed_'"cat_example/tfplan.json_|_./tf-summarize-test_-html"' (0.00s)
    --- PASS: TestTFSummarize/when_tf-summarize_is_passed_'"cat_example/tfplan.json_|_./tf-summarize-test_-md_-html"' (0.00s)
PASS
coverage: 0.0% of statements
ok      github.com/dineshba/tf-summarize        0.470s  coverage: 0.0% of statements
=== RUN   TestJSONParser_Parse_Success
--- PASS: TestJSONParser_Parse_Success (0.00s)
=== RUN   TestJSONParser_Parse_InvalidJSON
--- PASS: TestJSONParser_Parse_InvalidJSON (0.00s)
=== RUN   TestNewJSONParser
--- PASS: TestNewJSONParser (0.00s)
=== RUN   TestCreateParser_JSONFile
--- PASS: TestCreateParser_JSONFile (0.00s)
=== RUN   TestCreateParser_Stdin
--- PASS: TestCreateParser_Stdin (0.00s)
=== RUN   TestCreateParser_BinaryFile
--- PASS: TestCreateParser_BinaryFile (0.00s)
=== RUN   TestCreateParser_InvalidFileName
--- PASS: TestCreateParser_InvalidFileName (0.00s)
PASS
coverage: 45.5% of statements
ok      github.com/dineshba/tf-summarize/parser 0.008s  coverage: 45.5% of statements
=== RUN   TestResourceChangeColor
--- PASS: TestResourceChangeColor (0.00s)
=== RUN   TestGetAllResourceChanges
--- PASS: TestGetAllResourceChanges (0.00s)
=== RUN   TestGetAllOutputChanges
--- PASS: TestGetAllOutputChanges (0.00s)
=== RUN   TestResourceChangeSuffix
--- PASS: TestResourceChangeSuffix (0.00s)
=== RUN   TestResourceChangeColorAndSuffixImport
--- PASS: TestResourceChangeColorAndSuffixImport (0.00s)
=== RUN   TestFilterNoOpResources
--- PASS: TestFilterNoOpResources (0.00s)
PASS
coverage: 93.7% of statements
ok      github.com/dineshba/tf-summarize/terraformstate 0.008s  coverage: 93.7% of statements
=== RUN   TestCreateTreeForEmptyResourceChanges
--- PASS: TestCreateTreeForEmptyResourceChanges (0.00s)
=== RUN   TestCreateTreeForOneResourceChanges
--- PASS: TestCreateTreeForOneResourceChanges (0.00s)
=== RUN   TestCreateTreeWithQuotesInResources
--- PASS: TestCreateTreeWithQuotesInResources (0.00s)
=== RUN   TestCreateTreeForOneResourceChangesMultiLevel
--- PASS: TestCreateTreeForOneResourceChangesMultiLevel (0.00s)
=== RUN   TestCreateTreeForTwoResourceChangesNoOverlap
--- PASS: TestCreateTreeForTwoResourceChangesNoOverlap (0.00s)
=== RUN   TestCreateTreeForTwoResourceChangesOverlap
--- PASS: TestCreateTreeForTwoResourceChangesOverlap (0.00s)
PASS
coverage: 62.1% of statements
ok      github.com/dineshba/tf-summarize/tree   0.009s  coverage: 62.1% of statements
=== RUN   TestHTMLWriterWithMockFileSystem
--- PASS: TestHTMLWriterWithMockFileSystem (0.00s)
=== RUN   TestJSONWriter
--- PASS: TestJSONWriter (0.00s)
=== RUN   TestSeparateTree_Write
=== RUN   TestSeparateTree_Write/Drawable_True
=== RUN   TestSeparateTree_Write/Drawable_False
=== RUN   TestSeparateTree_Write/Error_Handling
=== RUN   TestSeparateTree_Write/Error_Handling/Write_Error
=== RUN   TestSeparateTree_Write/Error_Handling/Tree_Writer_Error
=== RUN   TestSeparateTree_Write/Error_Handling/Final_Newline_Write_Error
--- PASS: TestSeparateTree_Write (0.00s)
    --- PASS: TestSeparateTree_Write/Drawable_True (0.00s)
    --- PASS: TestSeparateTree_Write/Drawable_False (0.00s)
    --- PASS: TestSeparateTree_Write/Error_Handling (0.00s)
        --- PASS: TestSeparateTree_Write/Error_Handling/Write_Error (0.00s)
        --- PASS: TestSeparateTree_Write/Error_Handling/Tree_Writer_Error (0.00s)
        --- PASS: TestSeparateTree_Write/Error_Handling/Final_Newline_Write_Error (0.00s)
=== RUN   TestTableWriter_Write_NoMarkdown
--- PASS: TestTableWriter_Write_NoMarkdown (0.00s)
=== RUN   TestTableWriter_Write_WithMarkdown
--- PASS: TestTableWriter_Write_WithMarkdown (0.00s)
=== RUN   TestTableWriter_NoChanges
--- PASS: TestTableWriter_NoChanges (0.00s)
=== RUN   TestTreeWriter_Write_DrawableTrue
--- PASS: TestTreeWriter_Write_DrawableTrue (0.00s)
=== RUN   TestTreeWriter_Write_NonDrawable
--- PASS: TestTreeWriter_Write_NonDrawable (0.00s)
=== RUN   TestTreeWriter_Write_NonDrawable_PrintTreeError
--- PASS: TestTreeWriter_Write_NonDrawable_PrintTreeError (0.00s)
=== RUN   TestTreeWriter_Write_PrintTreeError
--- PASS: TestTreeWriter_Write_PrintTreeError (0.00s)
=== RUN   TestTreeWriter_Write_EmptyChanges
--- PASS: TestTreeWriter_Write_EmptyChanges (0.00s)
=== RUN   TestHasOutputChanges
=== RUN   TestHasOutputChanges/No_changes
=== RUN   TestHasOutputChanges/Has_changes
=== RUN   TestHasOutputChanges/All_empty
--- PASS: TestHasOutputChanges (0.00s)
    --- PASS: TestHasOutputChanges/No_changes (0.00s)
    --- PASS: TestHasOutputChanges/Has_changes (0.00s)
    --- PASS: TestHasOutputChanges/All_empty (0.00s)
=== RUN   TestRemoveANSI
=== RUN   TestRemoveANSI/String_without_ANSI_escape
=== RUN   TestRemoveANSI/String_with_ANSI_escape
=== RUN   TestRemoveANSI/String_with_multiple_ANSI_escapes
=== RUN   TestRemoveANSI/Empty_string
--- PASS: TestRemoveANSI (0.00s)
    --- PASS: TestRemoveANSI/String_without_ANSI_escape (0.00s)
    --- PASS: TestRemoveANSI/String_with_ANSI_escape (0.00s)
    --- PASS: TestRemoveANSI/String_with_multiple_ANSI_escapes (0.00s)
    --- PASS: TestRemoveANSI/Empty_string (0.00s)
PASS
coverage: 87.4% of statements
ok      github.com/dineshba/tf-summarize/writer 0.011s  coverage: 87.4% of statements

Verified

This commit was signed with the committer’s verified signature.
Copy link
Owner

@dineshba dineshba left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @kumdeepakgit ... Have added few minor comments

@dineshba
Copy link
Owner

@kumdeepakgit
Copy link
Contributor Author

Also, looks there is a test failure: https://github.com/dineshba/tf-summarize/actions/runs/11233918381/job/31284281419?pr=78#step:8:83

@dineshba Yes, there were some flaky test cases, have updated those

@kumdeepakgit kumdeepakgit requested a review from dineshba October 11, 2024 11:04
@dineshba dineshba merged commit 3483af4 into dineshba:main Oct 14, 2024
1 check passed
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.

None yet

2 participants