The golang test mechanism is used to validate delta information.
Related groups of checks are split into different files with the golang
naming
scheme of xxxx_test.go
. Each test should be in a function called TestXXX
.
The tests are written as a series of function calls based around the template:
func TestXXXX(t *testing.T) {
set, err := delta.New()
if err != nil {
t.Fatal(err)
}
for k, v := range xxxxChecks {
t.Run(k, v(set))
}
}
where the specific xxxx
checks are given as a map of functions, e.g.:
var xxxxChecks = map[string]func(*meta.Set) func(t *testing.T){
"check for xxxx in situtation yyyy": func(set *meta.Set) func(t *testing.T) {
return func(t *testing.T) {
/* test goes here and can use "set" to access delta fields */
}
},
...
}
Tests can be run using go test
in the directory containing the test files.
These checks will produce error messages which will generally mean the data will not be allowed to be merged into the repository.
antennas_test.go
- check antenna installation overlap
- check for antenna installation mark overlaps
- check for missing antenna marks
- check for missing antenna assets
- check for missing antenna sessions
assets_test.go
- check for duplicate asset numbers
- check for duplicate equipment
calibrations_test.go
- check for calibration overlaps
- check for missing assets
cameras_test.go
- check for cameras installation equipment overlaps
- check for cameras installation mount overlaps
- check for cameras installation views
- check cameras assets
citations_test.go
- check for duplicate citations
combined_test.go
- check for sensor/recorder installation location overlaps
connections_test.go
- check for connection overlaps
- check for connection span mismatch
- check for missing connection stations
- check for missing connection sites
- check for missing connection site locations
- check for missing datalogger places
- check for missing sensor connections
- check for missing datalogger connections
- check for gauge duplication
- check for missing constituent gauges
dataloggers_test.go
- check for datalogger installation place overlaps
- check for datalogger installation equipment overlaps
- check for missing datalogger assets
doases_test.go
- check for doases installation equipment overlaps
- check for doases installation mount overlaps
- check for doases installation views
- check doases assets
features_test.go
- check for duplicated site features
- check for duplicated features
- check for duplicated feature sites
firmware_test.go
- check for firmware history overlaps
- check for firmware non-changes
- check for firmware assets
- check for latest installed receiver firmware
gains_test.go
- check for gain installation overlaps
- check for missing sites
gauges_test.go
- check for gauge duplication
- check for missing gauge stations
marks_test.go
- check for duplicated marks
metsensors_test.go
- check for metsensors installation equipment overlaps
- check for missing metsensor marks
- check for missing metsensor assets
monuments_test.go
- check for duplicated monuments
- check for monument ground relationships
- check for monument types
networks_test.go
- check for duplicated networks
placenames_test.go
- check for placename duplication
- check for placename latitude longitudes
- check for placename levels
polarities_test.go
- check for duplicate polarities
preamps_test.go
- check for duplicate preamps
radomes_test.go
- check for radomes installation equipment overlaps
- check for overlapping radomes installations
- check for missing radome marks
- check for missing radome assets
receivers_test.go
- check for receiver installation overlaps
- check for receiver installation equipment overlaps
- check for missing receiver marks
- check for missing receiver assets
- check for recorder installation overlaps
- check for invalid sensor azimuth
- check for invalid sensor dip
- check for missing recorder stations
- check for missing recorder sites
- check for missing assets
resps_test.go
- check for component response files
- check for channel response files
samples_test.go
- check for duplicate sampling site
- check for missing sample networks
sensors_test.go
- check for sensor installation overlaps
- check for invalid sensor azimuth
- check for invalid sensor dip
- check for missing sensor stations
- check for missing sensor sites
- check for missing assets
sessions_test.go
- check session overlap
- check session spans
- check session satellite system
- check session marks
sites_test.go
- check for duplicated sites
- check for duplicated station sites
stations_test.go
- check for duplicated stations
- check for missing networks
streams_test.go
- check for invalid axial labels
- check for invalid stream span overlaps
- check for invalid stream spans
- check for invalid stream sample rates
- check for invalid stream stations
- check for invalid dates: stream within station
- check for invalid stream sites
- check for invalid stream locations
- check for invalid dates: stream within site
- check for invalid stream sensor sites
- check for invalid stream recorder sites
telemetry_test.go
- check for overlapping telemeties
- check for zero gain telemetries
views_test.go
- check for duplicated views
There are a number of checks which are non-enforcing and will only produce
warning messages when the verbose flag is used (-v
) or when an unrelated
error is encountered in which case these warnings will be bundled into the
output.
Once these checks pass without error it is intended that they become enforcing checks.