Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

kubeyaml should not be a prerequisite for running the tests #1790

Closed
dimitropoulos opened this issue Mar 4, 2019 · 3 comments · Fixed by #1796
Closed

kubeyaml should not be a prerequisite for running the tests #1790

dimitropoulos opened this issue Mar 4, 2019 · 3 comments · Fixed by #1796

Comments

@dimitropoulos
Copy link
Contributor

dimitropoulos commented Mar 4, 2019

currently when running tests, there are errors unless you have kubeyaml in your path:

$ go test github.com/weaveworks/flux/daemon
--- FAIL: TestDaemon_Release (0.21s)
        daemon_test.go:838: applying changes: exec: "kubeyaml": executable file not found in $PATH
--- FAIL: TestDaemon_PolicyUpdate (0.22s)
        daemon_test.go:838: exec: "kubeyaml": executable file not found in $PATH
--- FAIL: TestDaemon_SyncStatus (0.26s)
        daemon_test.go:838: applying changes: exec: "kubeyaml": executable file not found in $PATH
--- FAIL: TestDaemon_JobStatusWithNoCache (0.13s)
        daemon_test.go:838: exec: "kubeyaml": executable file not found in $PATH
--- FAIL: TestDaemon_Automated (10.17s)
        daemon_test.go:821: Waiting for image tag: "2"
--- FAIL: TestDaemon_Automated_semver (10.11s)
        daemon_test.go:821: Waiting for image tag: "3"
event="Sync: 9d04903, default:daemonset/init, default:deployment/helloworld, default:deployment/list-deploy, default:deployment/locked-service, default:deployment/multi-deploy, default:deployment/semver, default:deployment/test-service, default:service/list-service, default:service/multi-service" logupstream=true
event="Sync: cba0b77, default:deployment/helloworld" logupstream=true
FAIL
FAIL    github.com/weaveworks/flux/daemon       23.027s

It seems reasonable enough to me that this can/should be automated out. Seems like we're close to that already anyway. There's a /bin folder in the Flux repo that contains a dockerfile for running kubeyaml:

#!/bin/sh
docker run --rm -i quay.io/squaremo/kubeyaml:0.5.1 "$@"

The code in question is in kubeyaml.go:

func execKubeyaml(in []byte, args []string) ([]byte, error) {
	cmd := exec.Command("kubeyaml", args...)
	...
	err := cmd.Run()
}

I don't have a solution off hand, but it seems reasonable that this is something you shouldn't need to install in your PATH before running tests. I could happily be persuaded otherwise. If this is intended, then I will update the documentation to list kubeyaml being in your path a requirement for the path.


For reference, here is what the Dockerfile.flux does:

# Get the kubeyaml binary (files) and put them on the path
COPY --from=quay.io/squaremo/kubeyaml:0.5.1 /usr/lib/kubeyaml /usr/lib/kubeyaml/
ENV PATH=/bin:/usr/bin:/usr/local/bin:/usr/lib/kubeyaml
@dimitropoulos
Copy link
Contributor Author

as an aside: there seem to be some refactors (#1120) lined up for kubeyaml's place in the codebase. Perhaps if there's reason to do anything more than update the developer docs to close this issue, this can be a part of that (larger) refactor.

@hiddeco
Copy link
Member

hiddeco commented Mar 4, 2019

If you run the whole testsuite (make test) your path will be adjusted.

@squaremo
Copy link
Member

squaremo commented Mar 5, 2019

it seems reasonable that this is something you shouldn't need to install in your PATH before running tests.

go test is not especially accommodating in this situation.

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

Successfully merging a pull request may close this issue.

3 participants