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

CI tester #39

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ jobs:
go build -v ./...
go test -v ./... -coverpkg=./... -coverprofile=ocr2_decryptionplugin_coverage.txt

- name: Race test OCR2 plugin
working-directory: ./go/ocr2/decryptionplugin
run: |
go test -race -v ./... -coverpkg=./... -coverprofile=ocr2_decryptionplugin_race_coverage.txt

- name: Download npm deps
working-directory: ./js/tdh2
run: npm install
Expand All @@ -75,6 +80,11 @@ jobs:
run: |
go build -v ./...
go test -v ./... -coverpkg=./... -coverprofile=tdh_coverage.txt

- name: Race test TDH2
working-directory: ./go/tdh2
run: |
go test -race -v ./... -coverpkg=./... -coverprofile=tdh_race_coverage.txt

- name: Upload Go test reports
if: always()
Expand All @@ -83,7 +93,9 @@ jobs:
name: go-test-results
path: |
./go/ocr2/decryptionplugin/ocr2_decryptionplugin_coverage.txt
./go/ocr2/decryptionplugin/ocr2_decryptionplugin_race_coverage.txt
./go/tdh2/tdh_coverage.txt
./go/tdh2/tdh_race_coverage.txt


sonar-scan:
Expand Down
39 changes: 39 additions & 0 deletions go/ocr2/decryptionplugin/fail_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package decryptionplugin

import (
"errors"
"os"
"sync"
"testing"
)

// func TestFail(t *testing.T) {
// if testing.Short() {
// t.Skip()
// }
// t.Fatal("fake failure")
// }

func TestRace(t *testing.T) {
var v int
var wg sync.WaitGroup
wg.Add(100)
for i := 0; i < 100; i++ {
go func() {
defer wg.Done()
v++
v--
}()
}
wg.Wait()
t.Log(v)
}

func TestLint(t *testing.T) {
const ALL_CAPS = 10 // should be AllCaps
err := os.ErrNotExist
if err == os.ErrNotExist { // should use errors.Is
err := errors.New("fake error") // shadowed variable
t.Log(err)
}
}
39 changes: 39 additions & 0 deletions go/tdh2/fail_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package tdh2

import (
"errors"
"os"
"sync"
"testing"
)

// func TestFail(t *testing.T) {
// if testing.Short() {
// t.Skip()
// }
// t.Fatal("fake failure")
// }

func TestRace(t *testing.T) {
var v int
var wg sync.WaitGroup
wg.Add(100)
for i := 0; i < 100; i++ {
go func() {
defer wg.Done()
v++
v--
}()
}
wg.Wait()
t.Log(v)
}

func TestLint(t *testing.T) {
const ALL_CAPS = 10 // should be AllCaps
err := os.ErrNotExist
if err == os.ErrNotExist { // should use errors.Is
err := errors.New("fake error") // shadowed variable
t.Log(err)
}
}
Loading