Files
query-orchestration/internal/job/collector/parse_test.go
T
Michael McGuinness 4ccb980593 Merged in feature/jobcollector (pull request #30)
Initial Job Collector (changes pending)

* movearroundtocleancollector

* internalgetfunctions

* completecollectorquery

* simplify

* fixtests

* addvendor

* noplaceholder
2025-01-21 12:28:46 +00:00

37 lines
917 B
Go

package collector
import (
"fmt"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"testing"
"github.com/google/uuid"
"github.com/stretchr/testify/assert"
)
func TestParseDBCollector(t *testing.T) {
c, err := parseDBCollector(nil)
assert.Nil(t, err)
assert.Nil(t, c)
ogc := Collector{
ID: uuid.New(),
JobID: uuid.New(),
MinCleanVersion: 1,
MinTextVersion: 2,
Fields: map[string]uuid.UUID{
"example_key": uuid.New(),
},
}
c, err = parseDBCollector(&repository.Fullactivecollector{
ID: database.MustToDBUUID(ogc.ID),
Jobid: database.MustToDBUUID(ogc.JobID),
Mincleanversion: ogc.MinCleanVersion,
Mintextversion: ogc.MinTextVersion,
Fields: []byte(fmt.Sprintf("{\"example_key\":\"%s\"}", ogc.Fields["example_key"])),
})
assert.Nil(t, err)
assert.EqualExportedValues(t, ogc, *c)
}