Skip to content

Commit

Permalink
fix ci and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaji-kharse committed Dec 19, 2024
1 parent 5150e08 commit cb1a081
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-dgraph-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
#!/bin/bash
# build the test binary
cd t; go build .
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Clean Up Environment
run: |
#!/bin/bash
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-dgraph-core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
go-version-file: go.mod
- name: Install protobuf-compiler
run: sudo apt update && sudo apt install -y protobuf-compiler
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Check protobuf
run: |
cd ./protos
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-dgraph-ldbc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
go-version-file: go.mod
- name: Make Linux Build and Docker Image
run: make docker-image
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Build Test Binary
run : |
#!/bin/bash
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-dgraph-load-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
go-version-file: go.mod
- name: Make Linux Build and Docker Image
run: make docker-image # this internally builds dgraph binary
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Build Test Binary
run: |
#!/bin/bash
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-dgraph-systest-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
git diff --exit-code -- .
- name: Make Linux Build and Docker Image
run: make docker-image
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Build Test Binary
run: |
#!/bin/bash
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-dgraph-tests-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
go mod tidy
make regenerate
git diff --exit-code -- .
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Make Linux Build and Docker Image
run: make docker-image # this internally builds dgraph binary
- name: Build Test Binary
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-dgraph-vector-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
git diff --exit-code -- .
- name: Make Linux Build and Docker Image
run: make docker-image
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Build Test Binary
run: |
#!/bin/bash
Expand Down
20 changes: 15 additions & 5 deletions t/t.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,16 @@ func mergeXMLFiles(outputFile string, files []string) error {
}
defer finalFile.Close()

finalFile.WriteString(`<?xml version="1.0" encoding="UTF-8"?>`)
finalFile.WriteString(`<testsuites>`)
testSuiteStr := `<testsuites>`
fileWriteErrorMsg := "failed to write string to the file: %v"

if _, err := finalFile.WriteString(`<?xml version="1.0" encoding="UTF-8"?>`); err != nil {
return fmt.Errorf(fileWriteErrorMsg, err)
}

if _, err := finalFile.WriteString(testSuiteStr); err != nil {
return fmt.Errorf(fileWriteErrorMsg, err)
}

for _, file := range files {
if _, err := os.Stat(file); os.IsNotExist(err) {
Expand All @@ -291,13 +299,15 @@ func mergeXMLFiles(outputFile string, files []string) error {
}

// Extract the <testsuite> element from the file and append it
parts := strings.SplitN(string(content), "<testsuite", 2)
parts := strings.SplitN(string(content), testSuiteStr, 2)
if len(parts) > 1 {
finalFile.WriteString("<testsuite" + parts[1])
finalFile.WriteString(testSuiteStr + parts[1])

Check failure on line 304 in t/t.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `finalFile.WriteString` is not checked (errcheck)
}
}

finalFile.WriteString(`</testsuites>`)
if _, err := finalFile.WriteString(testSuiteStr); err != nil {
return fmt.Errorf(fileWriteErrorMsg, err)
}
return nil
}

Expand Down

0 comments on commit cb1a081

Please sign in to comment.