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

crc 1.0.0 (new formula) #46083

Open
wants to merge 1 commit into
base: master
from

Conversation

@cblecker
Copy link
Contributor

cblecker commented Nov 1, 2019

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

Formula/crc.rb Outdated Show resolved Hide resolved

test do
# Simple test, as most actions require sudo as they interact with hyperkit
assert_match /^crc version: #{version}/, shell_output("#{bin}/crc version")

This comment has been minimized.

Copy link
@chenrui333

chenrui333 Nov 1, 2019

Member

It might be good to have some functional test to assert the formula's correctness.

This comment has been minimized.

Copy link
@cblecker

cblecker Nov 1, 2019

Author Contributor

As noted, this is only a basic test as the functional operations require sudo.

This comment has been minimized.

Copy link
@fxcoudert

fxcoudert Nov 2, 2019

Member

We could add another test, that fails due to lack of permission…

This comment has been minimized.

Copy link
@cblecker

cblecker Nov 2, 2019

Author Contributor

@fxcoudert Do you have an example of another formula that does this? Every other formula that I can find that requires sudo (e.g. bettercap, tcptraceroute, vsftpd, etc) all use a basic version or --help operation as a test.

This comment has been minimized.

Copy link
@fxcoudert

fxcoudert Nov 3, 2019

Member

boringtun, glooctl, and others.

From the standard “what is a good test” text I have stored:


We need a test that exercises the some of the functionality of the app. Version checks or usage checks (foo --version or foo --help) are not sufficient, as explained in the formula cookbook.

In most cases, a good test would involve running a simple test case: run #{bin}/foo input.txt.

  • Then you can check that the output is as expected (with assert_equal or assert_match on the output of shell_output)
  • You can also check that an output file was created, if that is expected: assert_predicate testpath/"output.txt", :exist?

Some advice for specific cases:

  • If the formula is a library, compile and run some simple code that links against it. It could be taken from upstream's documentation / source examples.
  • If the formula is for a GUI program, try to find some function that runs as command-line only, like a format conversion, reading or displaying a config file, etc.
  • If the software cannot function without credentials, a test could be to try to connect with invalid credentials (or without credentials) and confirm that it fails as expected.
  • Same if the software requires a virtual machine, docker instance, etc. to be running.

This comment has been minimized.

Copy link
@cblecker

cblecker Nov 4, 2019

Author Contributor

This is very helpful! Thank you @fxcoudert. I've added a better test.

@cblecker cblecker force-pushed the cblecker:crc branch from 8929e32 to dd1b5c7 Nov 1, 2019
os = "macos" if os == "darwin"

# Make and install binary
system "make", "out/#{os}-#{arch}/crc"

This comment has been minimized.

Copy link
@fxcoudert

fxcoudert Nov 2, 2019

Member

Simply hardcode values…

Suggested change
system "make", "out/#{os}-#{arch}/crc"
system "make", "out/darwin-amd64/crc"

That's what we generally do…

This comment has been minimized.

Copy link
@cblecker

cblecker Nov 2, 2019

Author Contributor

I did this so that this formula is linuxbrew compatible out of the box.

This comment has been minimized.

Copy link
@fxcoudert

fxcoudert Nov 3, 2019

Member

I see the appeal, but we should be consistent and do it throughout if we are to do it. Right now, we write formulas for Darwin.

@fxcoudert

This comment has been minimized.

Copy link
Member

fxcoudert commented Nov 3, 2019

Looking at the webpage, I'm wondering about the additional constraints on this software:

Each released crc binary expires 30 days after the release due to certificates embedded in the Openshift cluster.

and

To use these binaries, please follow the instructions at https://cloud.redhat.com/openshift/install/crc/installer-provisioned to obtain the needed pull-secret

I'm wondering whether it makes sense for us shipping software with such restrictions.

@cblecker cblecker force-pushed the cblecker:crc branch from dd1b5c7 to 180bd61 Nov 4, 2019
@cblecker cblecker force-pushed the cblecker:crc branch from 180bd61 to 1ba9847 Nov 4, 2019
@SMillerDev SMillerDev referenced this pull request Nov 5, 2019
5 of 5 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.