Merged in bugfix/toomanythreads (pull request #136)
Too Many Threads * dropthreads * assertstatus * assertstatus
This commit is contained in:
+29
-18
@@ -119,28 +119,39 @@ func TestProcess(t *testing.T) {
|
||||
"JSON_QUERY": "valuetwo",
|
||||
}
|
||||
|
||||
queryapitest.WaitForClientStatus(t, t.Context(), net.Client, clientId, queryapi.NOTSYNCED)
|
||||
queryapitest.WaitForClientStatus(t, t.Context(), net.Client, clientId, queryapi.INSYNC)
|
||||
|
||||
docRes, err = net.Client.GetDocumentWithResponse(t.Context(), doc.Id)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, docRes)
|
||||
require.NotNil(t, docRes.JSON200)
|
||||
assert.EqualExportedValues(t, expectedDoc, *docRes.JSON200)
|
||||
wg.Add(3)
|
||||
go func(t testing.TB) {
|
||||
docRes, err = net.Client.GetDocumentWithResponse(t.Context(), doc.Id)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, docRes)
|
||||
require.NotNil(t, docRes.JSON200)
|
||||
assert.EqualExportedValues(t, expectedDoc, *docRes.JSON200)
|
||||
wg.Done()
|
||||
}(t)
|
||||
|
||||
testRes, err := net.Client.TestQueryWithResponse(t.Context(), jsonId, queryapi.QueryTestRequest{
|
||||
QueryVersion: 1,
|
||||
DocumentId: doc.Id,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "valueone", testRes.JSON200.Value)
|
||||
go func(t testing.TB) {
|
||||
testRes, err := net.Client.TestQueryWithResponse(t.Context(), jsonId, queryapi.QueryTestRequest{
|
||||
QueryVersion: 1,
|
||||
DocumentId: doc.Id,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "valueone", testRes.JSON200.Value)
|
||||
wg.Done()
|
||||
}(t)
|
||||
|
||||
testRes, err = net.Client.TestQueryWithResponse(t.Context(), jsonId, queryapi.QueryTestRequest{
|
||||
QueryVersion: 2,
|
||||
DocumentId: doc.Id,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "valuetwo", testRes.JSON200.Value)
|
||||
go func(t testing.TB) {
|
||||
testRes, err := net.Client.TestQueryWithResponse(t.Context(), jsonId, queryapi.QueryTestRequest{
|
||||
QueryVersion: 2,
|
||||
DocumentId: doc.Id,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "valuetwo", testRes.JSON200.Value)
|
||||
wg.Done()
|
||||
}(t)
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
const pdfHelloWorld = `%PDF-1.4
|
||||
|
||||
@@ -26,7 +26,7 @@ func TestClient(t *testing.T) {
|
||||
|
||||
clientErrRes, err := client.GetClientWithResponse(ctx, "INVALID")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, http.StatusBadRequest, clientErrRes.StatusCode())
|
||||
test.AssertStatus(t, http.StatusBadRequest, clientErrRes.HTTPResponse)
|
||||
assert.Equal(t, "Unable to get client: no rows in result set", clientErrRes.JSON400.Message)
|
||||
|
||||
idRes, err := client.CreateClientWithResponse(ctx, queryapi.ClientCreate{
|
||||
@@ -34,14 +34,14 @@ func TestClient(t *testing.T) {
|
||||
Id: "EXA",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, http.StatusCreated, idRes.StatusCode())
|
||||
test.AssertStatus(t, http.StatusCreated, idRes.HTTPResponse)
|
||||
assert.NotNil(t, idRes.JSON201)
|
||||
assert.Equal(t, "EXA", idRes.JSON201.Id)
|
||||
id := idRes.JSON201.Id
|
||||
|
||||
clientRes, err := client.GetClientWithResponse(ctx, id)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, http.StatusOK, clientRes.StatusCode())
|
||||
test.AssertStatus(t, http.StatusOK, clientRes.HTTPResponse)
|
||||
assert.Equal(t, id, clientRes.JSON200.Id)
|
||||
assert.Equal(t, "example_name", clientRes.JSON200.Name)
|
||||
assert.False(t, clientRes.JSON200.CanSync)
|
||||
|
||||
@@ -2,6 +2,7 @@ package endtoend_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
@@ -61,6 +62,7 @@ func TestCollectorService(t *testing.T) {
|
||||
|
||||
collRes, err := client.GetCollectorByClientIdWithResponse(ctx, id)
|
||||
require.NoError(t, err)
|
||||
test.AssertStatus(t, http.StatusOK, collRes.HTTPResponse)
|
||||
assert.Equal(t, id, collRes.JSON200.ClientId)
|
||||
assert.Equal(t, int32(0), collRes.JSON200.ActiveVersion)
|
||||
assert.Equal(t, int32(0), collRes.JSON200.LatestVersion)
|
||||
@@ -83,10 +85,11 @@ func TestCollectorService(t *testing.T) {
|
||||
Fields: &fields,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 200, uRes.StatusCode())
|
||||
test.AssertStatus(t, http.StatusOK, uRes.HTTPResponse)
|
||||
|
||||
collRes, err = client.GetCollectorByClientIdWithResponse(ctx, id)
|
||||
require.NoError(t, err)
|
||||
test.AssertStatus(t, http.StatusOK, collRes.HTTPResponse)
|
||||
assert.Equal(t, id, collRes.JSON200.ClientId)
|
||||
assert.Equal(t, int32(1), collRes.JSON200.ActiveVersion)
|
||||
assert.Equal(t, int32(1), collRes.JSON200.LatestVersion)
|
||||
|
||||
Reference in New Issue
Block a user