Skip to content

Commit

Permalink
Check that RecordRequests and [[Server]] are not used with CLOUD_ENV
Browse files Browse the repository at this point in the history
Only disallow RecordRequests & CLOUD_ENV. Having [[Server]] is okay - we just should not use it.

don't raise
  • Loading branch information
denik committed Feb 11, 2025
1 parent e81ec4e commit feb1beb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test:

cover:
rm -fr ./acceptance/build/cover/
CLI_GOCOVERDIR=build/cover ${GOTESTSUM_CMD} -- -coverprofile=coverage.txt ${PACKAGES}
VERBOSE_TEST=1 CLI_GOCOVERDIR=build/cover ${GOTESTSUM_CMD} -- -coverprofile=coverage.txt ${PACKAGES}
rm -fr ./acceptance/build/cover-merged/
mkdir -p acceptance/build/cover-merged/
go tool covdata merge -i $$(printf '%s,' acceptance/build/cover/* | sed 's/,$$//') -o acceptance/build/cover-merged/
Expand Down Expand Up @@ -61,6 +61,6 @@ integration: vendor
$(INTEGRATION)

integration-short: vendor
$(INTEGRATION) -short
VERBOSE_TEST=1 $(INTEGRATION) -short

.PHONY: lint tidy lintcheck fmt test cover showcover build snapshot vendor schema integration integration-short acc-cover acc-showcover docs
9 changes: 5 additions & 4 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ import (
)

var (
KeepTmp bool
NoRepl bool
KeepTmp bool
NoRepl bool
VerboseTest bool = os.Getenv("VERBOSE_TEST") != ""
)

// In order to debug CLI running under acceptance test, set this to full subtest name, e.g. "bundle/variables/empty"
Expand Down Expand Up @@ -261,7 +262,7 @@ func runTest(t *testing.T, dir, coverDir string, repls testdiff.ReplacementsCont
// 2. The test is configured to record requests and assert on them. We need
// a duplicate of the default server to record requests because the default
// server otherwise is a shared resource.
if len(config.Server) > 0 || config.RecordRequests {
if cloudEnv == "" && (len(config.Server) > 0 || config.RecordRequests) {
server = testserver.New(t)
server.RecordRequests = config.RecordRequests
server.IncludeRequestHeaders = config.IncludeRequestHeaders
Expand Down Expand Up @@ -412,7 +413,7 @@ func doComparison(t *testing.T, repls testdiff.ReplacementsContext, dirRef, dirN
testutil.WriteFile(t, pathRef, valueNew)
}

if !equal && printedRepls != nil && !*printedRepls {
if VerboseTest && !equal && printedRepls != nil && !*printedRepls {
*printedRepls = true
var items []string
for _, item := range repls.Repls {
Expand Down

0 comments on commit feb1beb

Please sign in to comment.