-
Notifications
You must be signed in to change notification settings - Fork 35
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
Unit Test files for metaservice #82
base: development
Are you sure you want to change the base?
Conversation
gzip: gzip.NewWriter(fakeStr), | ||
} | ||
err := fakeCompressor.Close() | ||
assert.Nil(suite.T(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, Need to check if fakeStruct.Close
is getting called or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked
} | ||
data := make([]byte, 1024) | ||
_, err := fakeCompressor.Write(data) | ||
assert.Nil(suite.T(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add check if fakeStruct.Write
called with passed content or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type fakeStruct struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, If fakeStruct
is used in multiple packages, Adding a utility is more meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added mock path in which mocks are added
RegisterCompressionReaderPlugins(suite.typ, suite.readInvoke) | ||
|
||
suite.archFilePath = "fakeArchiveYard2/FakeArchfileName" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a common function to initialise common utilities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, Split the testcase based on the scenario handled. Please hanlde for all other test cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handled
var data1 []byte | ||
file1 := "testfile1" | ||
err = archiver.WriteFile(file1, data1) | ||
assert.NotNil(suite.T(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also ensure file content
tar: fakeTarWriter, | ||
} | ||
err := archiver.Close() | ||
assert.Nil(suite.T(), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also check if fake tar Close
function gets called
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checked
Signed-off-by: vineela1999 <[email protected]>
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: