Reviewing Core Plans example - binaries

Binaries can be a bit tricky to test, as they don’t have a running service. I encountered this when reviewing https://github.com/habitat-sh/core-plans/pull/1192

This was an update to core/dep - which packages the dep binary (which is a go dependency management tool).

Here is how I tested it:

  • Merged pull request after code review

  • Waited for builder to build the package and put it in the unstable channel

  • This is a go-related binary, so I needed a go application/service to test it with. I chose core-plans/dex, which is a go package and uses the go scaffolding
    (I have a local clone of http://github.com/habitat-sh/core-plans on my workstation)

cd path/to/core-plans/dex
  • Altered dex’s plan.sh file - added core-plans/dex/new-version/new-release as a dependency. I also set the HAB_BLDR_CHANNEL environmental variable to use unstable with HAB_BLDR_CHANNEL=unstable

  • Entered the studio

$ hab studio enter
  • Built the dex package
(studio) $ build
  • Exported the dex package as a docker image
(studio $ hab pkg export docker ./results/<latest_build.hart>
  • Exited the studio
 (studio $ exit)
  • Started a docker container from the new image
$ docker run -it core/dex)
  • ssh’d into the running container
$ docker exec -it <container_id> bash
  • Ran dep command to ensure that dep was installed and working
(container) $ dep version

Are you running in docker for a specific reason?

Solely for convenient isolation :slight_smile:

1 Like