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

Add make targets recetprotctl_install, test_skip_kube and modify test #486

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

john-westcott-iv
Copy link
Member

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:

make test
Testing with receptor binary from: /home/jowestco/GIT/github/john-westcott-iv/receptor/receptor
?   	github.com/ansible/receptor/cmd/receptor-cb	[no test files]
?   	github.com/ansible/receptor/cmd/receptor-cl	[no test files]
...

Addresses #108

@fosterseth fosterseth merged commit 22325e7 into ansible:devel Nov 16, 2021
Copy link
Member

@shanemcd shanemcd left a 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
Copy link
Member

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
Copy link
Member

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); \
Copy link
Member

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`"; \
Copy link
Member

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
Copy link
Member

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); \
Copy link
Member

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?

@shanemcd
Copy link
Member

The commit message also has a typo... 😓

Add make targets recetprotctl_install, test_skip_kube and modify test

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.

@shanemcd shanemcd mentioned this pull request Nov 17, 2021
shanemcd added a commit that referenced this pull request Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants