Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ integration-test: $(SELECTED_PACKAGE) build-mock-management-plane-grpc
TEST_ENV="Container" CONTAINER_OS_TYPE=$(CONTAINER_OS_TYPE) BUILD_TARGET="install-agent-local" CONTAINER_NGINX_IMAGE_REGISTRY=${CONTAINER_NGINX_IMAGE_REGISTRY} \
PACKAGES_REPO=$(OSS_PACKAGES_REPO) PACKAGE_NAME=$(PACKAGE_NAME) BASE_IMAGE=$(BASE_IMAGE) DOCKERFILE_PATH=$(DOCKERFILE_PATH) IMAGE_PATH=$(IMAGE_PATH) TAG=${IMAGE_TAG} \
OS_VERSION=$(OS_VERSION) OS_RELEASE=$(OS_RELEASE) \
go test -v ./test/integration
go test -timeout 15m -v ./test/integration

official-image-integration-test: $(SELECTED_PACKAGE) build-mock-management-plane-grpc
TEST_ENV="Container" CONTAINER_OS_TYPE=$(CONTAINER_OS_TYPE) CONTAINER_NGINX_IMAGE_REGISTRY=${CONTAINER_NGINX_IMAGE_REGISTRY} BUILD_TARGET="install" \
Expand Down
19 changes: 13 additions & 6 deletions test/integration/grpc_management_plane_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const (
"configuration file /etc/nginx/nginx.conf test failed\n"

retryCount = 5
retryWaitTime = 2 * time.Second
retryMaxWaitTime = 3 * time.Second
retryWaitTime = 4 * time.Second
retryMaxWaitTime = 5 * time.Second
)

var (
Expand Down Expand Up @@ -212,8 +212,6 @@ func TestGrpc_Reconnection(t *testing.T) {
require.NoError(t, err)
mockManagementPlaneAPIAddress = net.JoinHostPort(ipAddress, ports["9093/tcp"][0].HostPort)

time.Sleep(5 * time.Second)

currentID := verifyConnection(t, 2)
assert.Equal(t, originalID, currentID)
}
Expand Down Expand Up @@ -533,15 +531,24 @@ func verifyConnection(t *testing.T, instancesLength int) string {

client := resty.New()
client.SetRetryCount(retryCount).SetRetryWaitTime(retryWaitTime).SetRetryMaxWaitTime(retryMaxWaitTime)
connectionRequest := mpi.CreateConnectionRequest{}
client.AddRetryCondition(
func(r *resty.Response, err error) bool {
responseData := r.Body()

pb := protojson.UnmarshalOptions{DiscardUnknown: true}
unmarshalErr := pb.Unmarshal(responseData, &connectionRequest)

return r.StatusCode() == http.StatusNotFound || unmarshalErr != nil
},
)
url := fmt.Sprintf("http://%s/api/v1/connection", mockManagementPlaneAPIAddress)
t.Logf("Connecting to %s", url)
resp, err := client.R().EnableTrace().Get(url)

require.NoError(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode())

connectionRequest := mpi.CreateConnectionRequest{}

responseData := resp.Body()
t.Logf("Response: %s", string(responseData))
assert.True(t, json.Valid(responseData))
Expand Down