4ccb980593
Initial Job Collector (changes pending) * movearroundtocleancollector * internalgetfunctions * completecollectorquery * simplify * fixtests * addvendor * noplaceholder
37 lines
917 B
Go
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)
|
|
}
|