Add drone env vars to test output to distinguish the 2 unit test runs. (#8093)

**What this PR does / why we need it**:

Add the drone step name and branch to the test output. These are used to
distinguish between the two unit tests runs in a drone build. One unit
test run is for the current branch, the other is for the branch to be
merged to. This change helps in not reporting the unit tests results
twice.

There is also a fix for the TestPromtail test. The missing newline made
the test reporting fail.

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
pull/8064/head
Michel Hollands 2 years ago committed by GitHub
parent 8f1835fe3d
commit fcf198e701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Makefile
  2. 2
      clients/pkg/promtail/promtail_test.go

@ -289,7 +289,7 @@ lint:
########
test: all
$(GOTEST) -covermode=atomic -coverprofile=coverage.txt -p=4 ./... | tee test_results.txt
$(GOTEST) -covermode=atomic -coverprofile=coverage.txt -p=4 ./... | sed "s/$$/ ${DRONE_STEP_NAME} ${DRONE_SOURCE_BRANCH}/" | tee test_results.txt
compare-coverage:
./tools/diff_coverage.sh $(old) $(new) $(packages)

@ -89,7 +89,7 @@ func TestPromtail(t *testing.T) {
if t.Failed() {
return // Test has already failed; don't wait for everything to shut down.
}
fmt.Fprintf(os.Stdout, "wait close")
fmt.Fprintf(os.Stdout, "wait close\n")
wg.Wait()
if err != nil {
t.Fatal(err)

Loading…
Cancel
Save