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

update unit tests to check error messages #107

Merged
merged 4 commits into from
Jul 15, 2021

Conversation

yangcao77
Copy link
Collaborator

Signed-off-by: Stephanie yangcao@redhat.com

What does this PR do?

This PR updates unit tests to check if error message matches the expected regexp

What issues does this PR fix or reference?

Fixes devfile/api#523

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

Updated unit tests

@yangcao77 yangcao77 requested a review from maysunfaisal July 7, 2021 22:29
@openshift-ci openshift-ci bot requested a review from elsony July 7, 2021 22:29
@openshift-ci openshift-ci bot added the approved label Jul 7, 2021
Signed-off-by: Stephanie <yangcao@redhat.com>
@yangcao77 yangcao77 force-pushed the 523-check-ErrMsg-unittests branch from 83c2938 to 5526b14 Compare July 7, 2021 22:49
Signed-off-by: Stephanie <yangcao@redhat.com>
@yangcao77 yangcao77 force-pushed the 523-check-ErrMsg-unittests branch from dbd098f to 61b2b7f Compare July 8, 2021 14:14
Signed-off-by: Stephanie <yangcao@redhat.com>
@yangcao77 yangcao77 force-pushed the 523-check-ErrMsg-unittests branch from 671a20f to 2542790 Compare July 13, 2021 17:54
Copy link
Member

@maysunfaisal maysunfaisal left a comment

Choose a reason for hiding this comment

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

Thanks, thats a lot of chore changes

@@ -47,6 +48,8 @@ func TestGetContainers(t *testing.T) {
},
}

errMatches := "an expetced error"
Copy link
Member

Choose a reason for hiding this comment

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

typo, update others too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@@ -436,8 +446,8 @@ func TestGetVolumesAndVolumeMounts(t *testing.T) {
}

pvcVols, err := GetVolumesAndVolumeMounts(devObj, volumeParams, common.DevfileOptions{})
if tt.wantErr == (err == nil) {
t.Errorf("TestGetVolumesAndVolumeMounts() error = %v, wantErr %v", err, tt.wantErr)
if (tt.wantErr == nil) != (err == nil) {
Copy link
Member

Choose a reason for hiding this comment

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

can we keep one or the other, in the above test it was

if (err != nil) != (tt.wantErr != nil). Otherwise I am always thrown back and have to recalc it in my head 😛

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

pkg/devfile/parser/data/v2/attributes_test.go Show resolved Hide resolved
Signed-off-by: Stephanie <yangcao@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Jul 14, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maysunfaisal, 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:
  • OWNERS [maysunfaisal,yangcao77]

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

@yangcao77 yangcao77 merged commit a951b35 into devfile:main Jul 15, 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.

Improve library unit test to check for error message
2 participants