-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add make targets recetprotctl_install, test_skip_kube and modify test #486
Add make targets recetprotctl_install, test_skip_kube and modify test #486
Conversation
38ff8dc
to
540aa30
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really wish we didn't merge most of this code. I would like to see everything reverted except for lines 92 and 94, but both of those lines also have issues that I've noted in-line.
@@ -12,6 +12,7 @@ RELEASE := 1 | |||
OFFICIAL := yes | |||
APPVER := $(VERSION) | |||
endif | |||
SKIP_KUBE=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this is written breaks the ability to override this variable via an environment variable. Let's use this stripped-down Makefile as an example:
SKIP_KUBE=0
test:
@echo $(SKIP_KUBE)
The output is:
$ SKIP_KUBE=1 make test
0
If written it like this:
SKIP_KUBE ?= 0
test:
@echo $(SKIP_KUBE)
It works as expected:
$ SKIP_KUBE=1 make test
1
@@ -84,8 +85,14 @@ else | |||
TESTCMD = -run $(RUNTEST) | |||
endif | |||
|
|||
test_skip_kube: SKIP_KUBE=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the primary design aspects of Make is to augment its behavior by overriding variables. If we were to follow this pattern you've started here, things would get unwieldy rather quickly. This new target is unnecessary as you could achieve the same thing by running:
SKIP_KUBE=1 make test
test: | ||
@go test ./... -p 1 -parallel=16 $(TESTCMD) -count=1 | ||
@export PATH=$(PATH):$(PWD); \ | ||
export SKIP_KUBE=$(SKIP_KUBE); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary if you set the variable like I show in my comment above.
Another issue here is the indentation. There should be only 1 tab character here, followed by the number of spaces you would like to indent the code.
@go test ./... -p 1 -parallel=16 $(TESTCMD) -count=1 | ||
@export PATH=$(PATH):$(PWD); \ | ||
export SKIP_KUBE=$(SKIP_KUBE); \ | ||
echo "Testing with receptor binary from: `which receptor 2>/dev/null`"; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all environments will have which
, and this hides the error so it will be hard to tell what's going on without coming to look at this code.
@@ -84,8 +85,14 @@ else | |||
TESTCMD = -run $(RUNTEST) | |||
endif | |||
|
|||
test_skip_kube: SKIP_KUBE=1 | |||
test_skip_kube: test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These targets are unnecessary so they should be removed, but in the future, stuff like this should be added under .PHONY
.
test: | ||
@go test ./... -p 1 -parallel=16 $(TESTCMD) -count=1 | ||
@export PATH=$(PATH):$(PWD); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we want to invert the precedence here to always prefer the build artifact?
The commit message also has a typo... 😓
Going forward we should slow down and make sure there is adequate time for feedback and discussion. I don't see anything in here that would be considered urgent. |
recetprotctl_install - builds and installs receptorctl into your python environment in one command
test_skuo_kube - sets SKIP_KUBE env var = 1 before running test
test - now add
pwd
to your path (to pickup a built but not installed receptor binary) and tells you what binary its choosing for the test:Addresses #108