From cddd9871afcd3097697b289f566e3b4c389e43d7 Mon Sep 17 00:00:00 2001 From: Travis Turner Date: Tue, 16 Aug 2022 09:13:11 -0500 Subject: [PATCH] Distinguish between three copies of `fakeidp` service (#2192) There are currently three copies of a package called `fakeidp` in the featurebase repo: - ./idk/fakeidp/go.mod - ./internal/clustertests/fakeidp/go.mod - ./qa/fakeidp/go.mod All three have a `go.mod` file. While this is supported under golang's new Workspace support, what's not supported is that the modules share the same name (in this case "fakeidp"). This commit is a sort of temporary fix which renames the module for two of the instances. This prevents, for example, VSCode with workspace support enabled, from barfing. By the way, one can enable VSCode workspace support with the following setting: ``` // gopls "gopls": { "build.experimentalWorkspaceModule": true } ``` Also... This commit fixes the `make testv` target. It's probably not used anywhere (which I'm assuming because it was broken), but it's a handle target, so now it will list and run tests against all packages found in the repo, including the root package. --- Makefile | 32 +++++++++++++----------- idk/Dockerfile-fakeIDP | 2 +- idk/README.md | 4 +-- idk/fakeidp/go.mod | 2 +- internal/clustertests/Dockerfile-fakeIDP | 2 +- internal/clustertests/fakeidp/go.mod | 2 +- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 5f5c26f5f..9f02a1e1b 100644 --- a/Makefile +++ b/Makefile @@ -53,31 +53,33 @@ test: test-race: CGO_ENABLED=1 $(GO) test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -race -timeout $(RACE_TEST_TIMEOUT) -v -testv: topt testvsub +testv: testvsub -testv-race: topt-race testvsub-race +testv-race: testvsub-race # testvsub: run go test -v in sub-directories in "local mode" with incremental output, # avoiding go -test ./... "package list mode" which doesn't give output # until the test run finishes. Package list mode makes it hard to # find which test is hung/deadlocked. # +GOPACKAGES := $(shell $(GO) list ./...) testvsub: - set -e; for i in boltdb client ctl http pg pql rbf roaring server sql txkey; do \ - echo; echo "___ testing subpkg $$i"; \ - cd $$i; pwd; \ - $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout $(RACE_TEST_TIMEOUT) || break; \ - echo; echo "999 done testing subpkg $$i"; \ - cd ..; \ - done + @set -e; for pkg in $(GOPACKAGES); do \ + if [ $${pkg:0:38} == "github.com/molecula/featurebase/v3/idk" ]; then \ + echo; echo "___ skipping subpkg $$pkg"; \ + continue; \ + fi; \ + echo; echo "___ testing subpkg $$pkg"; \ + $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout $(RACE_TEST_TIMEOUT) $$pkg || break; \ + echo; echo "999 done testing subpkg $$pkg"; \ + done + testvsub-race: - set -e; for i in boltdb client ctl http pg pql rbf roaring server sql txkey; do \ - echo; echo "___ testing subpkg $$i -race"; \ - cd $$i; pwd; \ - CGO_ENABLED=1 $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -race -timeout $(RACE_TEST_TIMEOUT) || break; \ - echo; echo "999 done testing subpkg $$i -race"; \ - cd ..; \ + @set -e; for pkg in $(GOPACKAGES); do \ + echo; echo "___ testing subpkg $$pkg"; \ + CGO_ENABLED=1 $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -race -timeout $(RACE_TEST_TIMEOUT) $$pkg || break; \ + echo; echo "999 done testing subpkg $$pkg"; \ done bench: diff --git a/idk/Dockerfile-fakeIDP b/idk/Dockerfile-fakeIDP index a6f3729a7..80523d27e 100644 --- a/idk/Dockerfile-fakeIDP +++ b/idk/Dockerfile-fakeIDP @@ -4,4 +4,4 @@ WORKDIR / COPY fakeidp ./ RUN go build . -ENTRYPOINT ["/fakeidp"] +ENTRYPOINT ["/fakeidpidk"] diff --git a/idk/README.md b/idk/README.md index 2cf566851..cb406966a 100644 --- a/idk/README.md +++ b/idk/README.md @@ -12,7 +12,7 @@ In addition to these dependancies, you will need to be added to the moleculacorp First start the test environment. This is a docker-compose environment that includes pilosa and a confluent kafka stack. Run the following to start those services: - make startup + BRANCH_NAME=master make startup To build and run the integration tests, run: @@ -24,7 +24,7 @@ Then to shut down the test environment, run: You can run all of the previous commands by calling test-all: - make test-all + BRANCH_NAME=master make test-all The previous command is equivalent to running the following: diff --git a/idk/fakeidp/go.mod b/idk/fakeidp/go.mod index 7d0a51cee..3a799c638 100644 --- a/idk/fakeidp/go.mod +++ b/idk/fakeidp/go.mod @@ -1,4 +1,4 @@ -module fakeidp +module fakeidpidk go 1.17 diff --git a/internal/clustertests/Dockerfile-fakeIDP b/internal/clustertests/Dockerfile-fakeIDP index b46556b80..9c2f54cb5 100644 --- a/internal/clustertests/Dockerfile-fakeIDP +++ b/internal/clustertests/Dockerfile-fakeIDP @@ -4,4 +4,4 @@ WORKDIR / COPY fakeidp ./ RUN go build . -ENTRYPOINT ["/fakeidp"] +ENTRYPOINT ["/fakeidpclustertests"] diff --git a/internal/clustertests/fakeidp/go.mod b/internal/clustertests/fakeidp/go.mod index 7d0a51cee..6a73ecb4d 100644 --- a/internal/clustertests/fakeidp/go.mod +++ b/internal/clustertests/fakeidp/go.mod @@ -1,4 +1,4 @@ -module fakeidp +module fakeidpclustertests go 1.17