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

RFC: Support testing of Habitat plans #1465

Open
ksexton opened this issue Nov 9, 2016 · 6 comments
Open

RFC: Support testing of Habitat plans #1465

ksexton opened this issue Nov 9, 2016 · 6 comments

Comments

@ksexton
Copy link
Contributor

ksexton commented Nov 9, 2016

CC @eeyun @Hoverbear

Currently Habitat does not support testing that the package created matches what the package author intended. As a package author, I would like to have the ability to ensure that plan updates do not break things that I have specified in my tests.

Some possible ways this could be accomplished:

  • Extend studio to support running tests with a do_test() block
  • Extend hab with something like hab pkg test or hab plan test

This could also be useful in a build pipeline. A package could build successfully but not pass the test and be kept from creating the artifact.

@Hoverbear
Copy link

Hoverbear commented Nov 9, 2016

@ksexton and I noted this would be useful for testing things such as:

  • Files which should exist do exist.
  • Files contain expected contents.
  • Files are appropriately changed when cfg variables are changed (via environment or otherwise).

We noted that do_test() would allow for the user to customize how they preferred to test their application, such as via test and stat or by something more such as http://inspec.io/.

This could additionally introduce something like "Test Dependencies" alongside "Build Dependencies" to facilitate the depending on said packages if necessary. These "Test Dependencies" could would not be required during the build or execution steps.

@Hoverbear
Copy link

@smith commented in the Habi-chat:

Inspec has a toml parser in its gemfile but it doesn't ship with it. You could totally have your specs inspect and modify the hab ring and do stuff like (psevdocode):

describe "my-service" do
  with_config do |cfg|
    cfg.port = 1000
  end

  it "has the port open" do
    expect(cfg.port).to be_listening
  end
end

@mickfeech
Copy link

I like the idea of a do_test() implementation

@themightychris
Copy link
Contributor

themightychris commented Jun 27, 2018

Another thing that would be nice to either test by default or have a built-in helper method available to invoke from tests is running ldd over all binaries in the build output, checking that no shared library links are broken, and checking that all linked libraries are listed in pkg_deps

This was discussed more heavily in #1470. One comment from that thread was that some packages, like core/jre8, have some cruft binaries in their output you won't care about leaving broken. I suggest that in that case a plan author should either have their do_install implementation delete the binaries they don't intend to support before the test runs, or have to override do_links_test() { return 0 } to skip that test

This would make the habitat build process easier to learn since you could get clear errors about common mistakes rather than "not found" errors on a binary that's clearly there down the line, and it would increase the overall quality and reliability of packages

@stale
Copy link

stale bot commented Apr 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

@stale stale bot added the Stale label Apr 3, 2020
@christophermaier christophermaier added Type: Feature Issues that describe a new desired feature and removed C-feature labels Jul 24, 2020
@stale stale bot removed the Stale label Jul 24, 2020
@stale
Copy link

stale bot commented Oct 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants