Skip to content

Commit

Permalink
feat: add extra equipment installation checks
Browse files Browse the repository at this point in the history
These checks help spot when something has been installed after it has been removed, or removed before it has been installed
  • Loading branch information
ozym committed Aug 3, 2024
1 parent a98babe commit bd2c7b3
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tests/antennas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ var antennaChecks = map[string]func(*meta.Set) func(t *testing.T){
}
},

"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.InstalledAntennas() {
if i.End.After(i.Start) {
continue
}
t.Errorf("installed antenna is removed before it has been installed: %s", i.String())
}
}
},

"check for antenna installation mark overlaps": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
installs := make(map[string]meta.InstalledAntennaList)
Expand Down
11 changes: 11 additions & 0 deletions tests/cameras_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ var cameraChecks = map[string]func(*meta.Set) func(t *testing.T){
}
},

"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.InstalledCameras() {
if i.End.After(i.Start) {
continue
}
t.Errorf("installed camera is removed before it has been installed: %s", i.String())
}
}
},

"check for cameras installation mount overlaps": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
keys := make(map[string]interface{})
Expand Down
11 changes: 11 additions & 0 deletions tests/dataloggers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ var dataloggerChecks = map[string]func(*meta.Set) func(t *testing.T){
}
}
},

"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.DeployedDataloggers() {
if i.End.After(i.Start) {
continue
}
t.Errorf("deployed datalogger is removed before it has been installed: %s", i.String())
}
}
},
}

func TestDataloggers(t *testing.T) {
Expand Down
11 changes: 11 additions & 0 deletions tests/doases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ var doasChecks = map[string]func(*meta.Set) func(t *testing.T){
}
},

"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.Doases() {
if i.End.After(i.Start) {
continue
}
t.Errorf("installed doas is removed before it has been installed: %s", i.String())
}
}
},

"check for doases installation mount overlaps": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
keys := make(map[string]interface{})
Expand Down
10 changes: 10 additions & 0 deletions tests/metsensors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ var metSensorChecks = map[string]func(*meta.Set) func(t *testing.T){
}
}
},
"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.InstalledMetSensors() {
if i.End.After(i.Start) {
continue
}
t.Errorf("installed metsensor is removed before it has been installed: %s", i.String())
}
}
},
"check for missing metsensor marks": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
keys := make(map[string]interface{})
Expand Down
12 changes: 11 additions & 1 deletion tests/radomes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ var installedRadomeChecks = map[string]func(*meta.Set) func(t *testing.T){
}
}
},

"check for overlapping radomes installations": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
installs := make(map[string]meta.InstalledRadomeList)
Expand Down Expand Up @@ -63,6 +62,17 @@ var installedRadomeChecks = map[string]func(*meta.Set) func(t *testing.T){
}
},

"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.InstalledRadomes() {
if i.End.After(i.Start) {
continue
}
t.Errorf("installed radome is removed before it has been installed: %s", i.String())
}
}
},

"check for missing radome marks": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {

Expand Down
11 changes: 11 additions & 0 deletions tests/receivers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ var deployedReceiverChecks = map[string]func(*meta.Set) func(t *testing.T){
}
},

"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.DeployedReceivers() {
if i.End.After(i.Start) {
continue
}
t.Errorf("deployed receiver is removed before it has been installed: %s", i.String())
}
}
},

"check for missing receiver marks": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {

Expand Down
11 changes: 11 additions & 0 deletions tests/recorders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ var installedRecorderChecks = map[string]func(*meta.Set) func(t *testing.T){
}
},

"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.InstalledRecorders() {
if i.End.After(i.Start) {
continue
}
t.Errorf("installed recorder is removed before it has been installed: %s", i.String())
}
}
},

"check for invalid sensor azimuth": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {

Expand Down
11 changes: 11 additions & 0 deletions tests/sensors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ var installedSensorChecks = map[string]func(*meta.Set) func(t *testing.T){
}
},

"check for invalid installation dates": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
for _, i := range set.InstalledSensors() {
if i.End.After(i.Start) {
continue
}
t.Errorf("installed sensor is removed before it has been installed: %s", i.String())
}
}
},

"check for invalid sensor azimuth": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {

Expand Down

0 comments on commit bd2c7b3

Please sign in to comment.