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

More BeTrue cleanup #12454

Merged
merged 3 commits into from
Nov 30, 2021
Merged

Conversation

edsantiago
Copy link
Member

  • e2e tests: more cleanup of BeTrue()s
  • Convert strings.Contains() to Expect(ContainSubstring)
  • a few more manual BeTrue cleanups

Write a BeValidJSON() matcher, and replace IsJSONOutputValid():

  sed -i -e 's/Expect(\(.*\)\.IsJSONOutputValid()).To(BeTrue())/Expect(\1.OutputToString())\.To(BeValidJSON())/' test/e2e/*_test.go

(Plus a few manual tweaks)

Signed-off-by: Ed Santiago <[email protected]>
...done manually, not via sed, because some of the inner
expressions include nested commas.

Signed-off-by: Ed Santiago <[email protected]>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 30, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 30, 2021
@edsantiago edsantiago changed the title remove betrue More BeTrue cleanup Nov 30, 2021
@rhatdan
Copy link
Member

rhatdan commented Nov 30, 2021

LGTM

@@ -225,7 +225,7 @@ var _ = Describe("Podman commit", func() {
Expect(inspect).Should(Exit(0))
image := inspect.InspectImageJSON()
_, ok := image[0].Config.Volumes["/foo"]
Expect(ok).To(BeTrue())
Expect(ok).To(BeTrue(), ".Config.Volumes[/foo]")
Copy link
Member

Choose a reason for hiding this comment

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

FYI This can be changed to Expect(image[0].Config.Volumes).To(HaveKey("/foo))

The same for the other place where you compare a map. There is also a HaveKeyWithValue() function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, nice, thank you!

@rhatdan
Copy link
Member

rhatdan commented Nov 30, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 30, 2021
@openshift-merge-robot openshift-merge-robot merged commit 295a6f7 into containers:main Nov 30, 2021
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Thank you, @edsantiago! I find such PRs invaluable

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants