Skip to content

Add events and metadata tests #102

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

Merged
merged 5 commits into from
Jun 28, 2021
Merged

Conversation

kim-tsao
Copy link
Contributor

What does this PR do?

  • Adds tests for events and metadata objects.
  • Bug fix in the devfileFollower.LibraryData.UpdateEvents call, where parameters were out of order
  • Removed unused TestContent struct in library_test.go. We are using the one from the common utils

What issues does this PR fix or reference?

devfile/api#502

Is your PR tested? Consider putting some instruction how to test your changes

This was tested locally. Output in generated yamls and test.log were verified

@kim-tsao kim-tsao marked this pull request as ready for review June 23, 2021 19:59
@kim-tsao kim-tsao requested a review from maysunfaisal June 24, 2021 14:08
func Test_ExecCommand(t *testing.T) {
testContent := commonUtils.TestContent{}
testContent.CommandTypes = []schema.CommandType{schema.ExecCommandType}
testContent.AddEvents = commonUtils.GetBinaryDecision()
Copy link
Collaborator

Choose a reason for hiding this comment

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

AddEvents randomly set event values: https://github.com/devfile/api/blob/b08e48618403f7102592389e621531145bdfcbcc/test/v200/utils/common/events-utils.go#L35
looks like you cannot control to be only Exec or Apply or composite command.
Should not be under test for each particular type of command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I see what you mean. SetEventValues will create extra commands that will be outside the scope of the Exec testing, so I need to narrow this down to just the commands that Exec or composite Exec supports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the easiest thing to do in this case is what you suggested; to remove events testing in these scenarios (otherwise I'd have to introduce new functions in the api utils). I added new events test cases similar to what's being done in api tests, so that should ensure sufficient coverage.

Copy link
Collaborator

@yangcao77 yangcao77 left a comment

Choose a reason for hiding this comment

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

lgtm

@openshift-ci
Copy link

openshift-ci bot commented Jun 25, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kim-tsao, yangcao77

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kim-tsao kim-tsao merged commit bb25787 into devfile:main Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants