Skip to content

Unit Test files for metaservice#82

Open
vineela1999 wants to merge 15 commits into
soda-cdm:developmentfrom
vineela1999:UtPr
Open

Unit Test files for metaservice#82
vineela1999 wants to merge 15 commits into
soda-cdm:developmentfrom
vineela1999:UtPr

Conversation

@vineela1999

@vineela1999 vineela1999 commented Aug 2, 2022

Copy link
Copy Markdown
Contributor

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind new feature
/kind bug fix
/kind cleanup
/kind revert change
/kind design
/kind documentation
kind enhancement

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?:

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:
kind TESTED
/kind NOT-TESTED

Test Report:

Special notes for your reviewer:

@vineela1999 vineela1999 changed the title Unit Test files for Kahu project [WIP]Unit Test files for Kahu project Aug 16, 2022
@vineela1999 vineela1999 changed the title [WIP]Unit Test files for Kahu project Unit Test files for metaservice Aug 22, 2022
gzip: gzip.NewWriter(fakeStr),
}
err := fakeCompressor.Close()
assert.Nil(suite.T(), err)

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor Author

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)

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor Author

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{}

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Contributor Author

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"
}

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor Author

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)

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Contributor Author

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)

Copy link
Copy Markdown
Collaborator

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)

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

checked

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.

2 participants