Unit Test files for metaservice#82
Conversation
| gzip: gzip.NewWriter(fakeStr), | ||
| } | ||
| err := fakeCompressor.Close() | ||
| assert.Nil(suite.T(), err) |
There was a problem hiding this comment.
IMO, Need to check if fakeStruct.Close is getting called or not
| } | ||
| data := make([]byte, 1024) | ||
| _, err := fakeCompressor.Write(data) | ||
| assert.Nil(suite.T(), err) |
There was a problem hiding this comment.
Need to add check if fakeStruct.Write called with passed content or not
| "github.com/stretchr/testify/suite" | ||
| ) | ||
|
|
||
| type fakeStruct struct{} |
There was a problem hiding this comment.
IMO, If fakeStruct is used in multiple packages, Adding a utility is more meaningful.
There was a problem hiding this comment.
added mock path in which mocks are added
| RegisterCompressionReaderPlugins(suite.typ, suite.readInvoke) | ||
|
|
||
| suite.archFilePath = "fakeArchiveYard2/FakeArchfileName" | ||
| } |
There was a problem hiding this comment.
Please add a common function to initialise common utilities
There was a problem hiding this comment.
added funcs to call instead
| fakefile := suite.archFileName | ||
| err1 := fmt.Errorf("archival file(fakeArchiveYard1/FakeArchfileName) already exist") | ||
| _, _, err = suite.mgr.GetArchiver(suite.typ, fakefile) | ||
| assert.Equal(suite.T(), err1, err) |
There was a problem hiding this comment.
IMHO, Split the testcase based on the scenario handled. Please hanlde for all other test cases.
| var data1 []byte | ||
| file1 := "testfile1" | ||
| err = archiver.WriteFile(file1, data1) | ||
| assert.NotNil(suite.T(), err) |
There was a problem hiding this comment.
Please also ensure file content
| tar: fakeTarWriter, | ||
| } | ||
| err := archiver.Close() | ||
| assert.Nil(suite.T(), err) |
There was a problem hiding this comment.
Please also check if fake tar Close function gets called
Signed-off-by: vineela1999 <vineelapachipulusu@gmail.com>
What type of PR is this?
What this PR does / why we need it:
This PR has all UT files for files under providerframework/metaservice
Which issue(s) this PR fixes:
Fixes #
Test Report Added?:
Test Report:
Special notes for your reviewer: