Merged in feature/CollectorBuildVersion (pull request #100)
Collector Build Version * lint * fixtests
This commit is contained in:
@@ -2,9 +2,6 @@ package endtoend
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
@@ -26,8 +23,7 @@ func TestCollectorService(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &CollectorConfig{}
|
||||
test.SetCfgProvider(t, cfg)
|
||||
cfg.SetBasePath(path.Join(os.Getenv("PWD"), "../.."))
|
||||
test.SetCfgProviderWithBasePath(t, cfg, "../..")
|
||||
|
||||
network, ncleanup := test.CreateNetwork(t, ctx)
|
||||
defer ncleanup()
|
||||
@@ -38,8 +34,7 @@ func TestCollectorService(t *testing.T) {
|
||||
})
|
||||
defer clean()
|
||||
|
||||
err := cfg.SetQueueClient(ctx)
|
||||
assert.NoError(t, err)
|
||||
test.SetQueueClient(t, ctx, cfg)
|
||||
clientsyncurl := test.CreateQueue(t, ctx, cfg, test.ClientSyncRunner)
|
||||
|
||||
c, cleanup := test.CreateServiceNetwork(t, ctx, &test.ServiceNetworkConfig{
|
||||
@@ -83,8 +78,8 @@ func TestCollectorService(t *testing.T) {
|
||||
assert.Equal(t, id, collRes.JSON200.ClientId)
|
||||
assert.Equal(t, int32(0), collRes.JSON200.ActiveVersion)
|
||||
assert.Equal(t, int32(0), collRes.JSON200.LatestVersion)
|
||||
assert.Equal(t, int32(0), collRes.JSON200.MinimumCleanerVersion)
|
||||
assert.Equal(t, int32(0), collRes.JSON200.MinimumTextVersion)
|
||||
assert.Equal(t, int64(0), collRes.JSON200.MinimumCleanerVersion)
|
||||
assert.Equal(t, int64(0), collRes.JSON200.MinimumTextVersion)
|
||||
assert.Len(t, collRes.JSON200.Fields, 0)
|
||||
|
||||
av := int32(1)
|
||||
@@ -94,23 +89,25 @@ func TestCollectorService(t *testing.T) {
|
||||
QueryId: jsonRes.JSON201.Id,
|
||||
},
|
||||
}
|
||||
minVersion := int64(1000)
|
||||
uRes, err := client.SetCollectorByClientIdWithResponse(ctx, id, queryservice.CollectorSet{
|
||||
ActiveVersion: &av,
|
||||
Fields: &fields,
|
||||
ActiveVersion: &av,
|
||||
MinimumCleanerVersion: &minVersion,
|
||||
MinimumTextVersion: &minVersion,
|
||||
Fields: &fields,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
log.Print(string(uRes.Body))
|
||||
assert.Equal(t, 200, uRes.StatusCode())
|
||||
|
||||
test.AssertMessageBody(t, ctx, cfg, clientsyncurl, regexp.MustCompile(`{"id":".+"}`))
|
||||
|
||||
collRes, err = client.GetCollectorByClientIdWithResponse(ctx, id)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, id, collRes.JSON200.ClientId)
|
||||
assert.Equal(t, int32(1), collRes.JSON200.ActiveVersion)
|
||||
assert.Equal(t, int32(1), collRes.JSON200.LatestVersion)
|
||||
assert.Equal(t, int32(0), collRes.JSON200.MinimumCleanerVersion)
|
||||
assert.Equal(t, int32(0), collRes.JSON200.MinimumTextVersion)
|
||||
assert.Equal(t, minVersion, collRes.JSON200.MinimumCleanerVersion)
|
||||
assert.Equal(t, minVersion, collRes.JSON200.MinimumTextVersion)
|
||||
assert.Len(t, collRes.JSON200.Fields, 1)
|
||||
assert.ElementsMatch(t, fields, collRes.JSON200.Fields)
|
||||
|
||||
test.AssertMessageBody(t, ctx, cfg, clientsyncurl, regexp.MustCompile(`{"id":".+"}`))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user