Compare commits

...

7 Commits

Author SHA1 Message Date
John Donaldson e5b6bf487a Fix file deletion strategy 2022-10-21 15:12:47 -07:00
John Donaldson b01a500189 Add test for deleted teamids.txt 2022-10-21 15:08:28 -07:00
John Donaldson e00ee97a98 Merge branch 'main' of https://git.cyberfire.ninja/devs/moth into add_admin_state_mechanisms 2022-10-21 14:58:18 -07:00
John Donaldson 5720961e85 Merge branch 'add_unit_test_coverage_report' into 'main'
Add better reporting on unit tests

See merge request devs/moth!178
2022-10-21 21:57:43 +00:00
John Donaldson 466de2d9c6 Let the test handler take care of installing stuff 2022-10-21 14:54:00 -07:00
John Donaldson 92d904150a Add better reporting on unit tests 2022-10-21 14:52:26 -07:00
John Donaldson 9783f99a39 Add test for team name state 2022-10-21 14:41:59 -07:00
2 changed files with 33 additions and 3 deletions

View File

@ -11,8 +11,14 @@ test:
- main - main
- merge_requests - merge_requests
script: script:
- go test -race ./... - go test -coverprofile=coverage.txt -covermode=atomic -race ./...
- go get github.com/boumenot/gocover-cobertura
- go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
push: push:
stage: push stage: push
rules: rules:

View File

@ -627,8 +627,32 @@ func TestStateTeamIDs(t *testing.T) {
t.Errorf("Expected to find 0 team ID, found %d (%s), instead", len(teamIDs), teamIDs) t.Errorf("Expected to find 0 team ID, found %d (%s), instead", len(teamIDs), teamIDs)
} }
} }
}
func TestStateDeleteTeamIDList(t *testing.T) {
s := NewTestState()
s.refresh()
s.Fs.Remove("teamids.txt")
teamIDs, err := s.TeamIDs()
if len(teamIDs) != 0 {
t.Errorf("Expected to find 0 team IDs, found %d (%s), instead", len(teamIDs), teamIDs)
}
if err == nil {
t.Errorf("Did not receive expected error for non-existent teamids.txt")
}
}
func TestStateTeamNames(t *testing.T) {
s := NewTestState()
s.refresh()
if teamNames := s.TeamNames(); len(teamNames) != 0 {
t.Errorf("Expected to find 0 registered teams, found %d (%s), instead", len(teamNames), teamNames)
}
} }
func TestDevelState(t *testing.T) { func TestDevelState(t *testing.T) {