Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Commit

Permalink
test: update proto definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
heiruwu committed Jun 21, 2023
1 parent f358855 commit dd87766
Show file tree
Hide file tree
Showing 22 changed files with 321 additions and 331 deletions.
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ mgmtbackend:
cert:
key:
log:
external: true
external: false
otelcollector:
host: otel-collector
port: 8095
10 changes: 6 additions & 4 deletions integration-test/const.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { uuidv4 } from 'https://jslib.k6.io/k6-utils/1.4.0/index.js';

let proto
let tHost, mgHost, pHost, cHost, mHost, ctHost
let tPublicPort, mgPublicPort, mgPrivatePort, pPublicPort, pPrivatePort, cPublicPort, cPrivatePort, mPublicPort, mPrivatePort, ctPrivatePort
Expand Down Expand Up @@ -58,16 +60,16 @@ export const controllerPrivateHost = `${proto}://${ctHost}:${ctPrivatePort}`;

export const controllerGRPCPrivateHost = `${ctHost}:${ctPrivatePort}`;

export const modelResourceName = "resources/this-is-model-name/types/models"
export const modelResourcePermalink = `resources/${uuidv4()}/types/models`
export const modelName = "models/model-name"

export const sourceConnectorResourceName = "resources/source-connector-name/types/source-connectors"
export const sourceConnectorResourcePermalink = `resources/${uuidv4()}/types/source-connectors`
export const sourceConnectorName = "source-connectors/source-connector-name"

export const destinationConnectorResourceName = "resources/destination-connector-name/types/destination-connectors"
export const destinationConnectorResourcePermalink = `resources/${uuidv4()}/types/destination-connectors`
export const destinationConnectorName = "destination-connectors/destination-connector-name"

export const pipelineResourceName = "resources/pipeline-name/types/pipelines"
export const pipelineResourcePermalink = `resources/${uuidv4()}/types/pipelines`
export const pipelineName = "pipelines/pipeline-name"

export const serviceResourceName = "resources/model-backend/types/services"
Expand Down
62 changes: 33 additions & 29 deletions integration-test/controller-private.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ clientPrivate.load(['proto/vdp/controller/v1alpha'], 'controller_service.proto')

export function CheckModelResource() {
var httpModelResource = {
"name": constant.modelResourceName,
"resource_permalink": constant.modelResourcePermalink,
"model_state": "STATE_ONLINE"
}

Expand All @@ -24,28 +24,32 @@ export function CheckModelResource() {
resource: httpModelResource
})

console.log(resCreateModelHTTP)

console.log(httpModelResource.resource_permalink)

check(resCreateModelHTTP, {
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response StatusOK": (r) => r.status === grpc.StatusOK,
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response modelResource name matched": (r) => r.message.resource.name == httpModelResource.name,
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response modelResource resource_permalink matched": (r) => r.message.resource.resourcePermalink == httpModelResource.resource_permalink,
});
});

group("Controller API: Get model resource state in etcd", () => {
var resGetModelHTTP = clientPrivate.invoke(`vdp.controller.v1alpha.ControllerPrivateService/GetResource`, {
name: httpModelResource.name
resource_permalink: httpModelResource.resource_permalink
})

check(resGetModelHTTP, {
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpModelResource.name} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpModelResource.name} response modelResource name matched`]: (r) => r.message.resource.name === httpModelResource.name,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpModelResource.name} response modelResource state matched STATE_ONLINE`]: (r) => r.message.resource.modelState == "STATE_ONLINE",
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpModelResource.resource_permalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpModelResource.resource_permalink} response modelResource resource_permalink matched`]: (r) => r.message.resource.resourcePermalink === httpModelResource.resource_permalink,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpModelResource.resource_permalink} response modelResource state matched STATE_ONLINE`]: (r) => r.message.resource.modelState == "STATE_ONLINE",
});
});
}

export function CheckSourceConnectorResource() {
var httpSourceConnectorResource = {
"name": constant.sourceConnectorResourceName,
"resource_permalink": constant.sourceConnectorResourcePermalink,
"connector_state": "STATE_CONNECTED"
}

Expand All @@ -60,26 +64,26 @@ export function CheckSourceConnectorResource() {

check(resCreateSourceConnectorHTTP, {
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response StatusOK": (r) => r.status === grpc.StatusOK,
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response connectorResource name matched": (r) => r.message.resource.name == httpSourceConnectorResource.name,
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response connectorResource resource_permalink matched": (r) => r.message.resource.resourcePermalink == httpSourceConnectorResource.resource_permalink,
});
});

group("Controller API: Get source connector resource state in etcd", () => {
var resGetSourceConnectorHTTP = clientPrivate.invoke(`vdp.controller.v1alpha.ControllerPrivateService/GetResource`, {
name: httpSourceConnectorResource.name
resource_permalink: httpSourceConnectorResource.resource_permalink
})

check(resGetSourceConnectorHTTP, {
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpSourceConnectorResource.name} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpSourceConnectorResource.name} response connectorResource name matched`]: (r) => r.message.resource.name === httpSourceConnectorResource.name,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpSourceConnectorResource.name} response connectorResource state matched STATE_CONNECTED`]: (r) => r.message.resource.connectorState == "STATE_CONNECTED",
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpSourceConnectorResource.resource_permalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpSourceConnectorResource.resource_permalink} response connectorResource resource_permalink matched`]: (r) => r.message.resource.resourcePermalink === httpSourceConnectorResource.resource_permalink,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpSourceConnectorResource.resource_permalink} response connectorResource state matched STATE_CONNECTED`]: (r) => r.message.resource.connectorState == "STATE_CONNECTED",
});
});
}

export function CheckDestinationConnectorResource() {
var httpDestinationConnectorResource = {
"name": constant.destinationConnectorResourceName,
"resource_permalink": constant.destinationConnectorResourcePermalink,
"connector_state": "STATE_CONNECTED"
}

Expand All @@ -94,26 +98,26 @@ export function CheckDestinationConnectorResource() {

check(resCreatpDestinationConnectorHTTP, {
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response StatusOK": (r) => r.status === grpc.StatusOK,
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response connectorResource name matched": (r) => r.message.resource.name == httpDestinationConnectorResource.name,
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response connectorResource resource_permalink matched": (r) => r.message.resource.resourcePermalink == httpDestinationConnectorResource.resource_permalink,
});
});

group("Controller API: Get destination connector resource state in etcd", () => {
var resGetDestinationConnectorHTTP = clientPrivate.invoke(`vdp.controller.v1alpha.ControllerPrivateService/GetResource`, {
name: httpDestinationConnectorResource.name
resource_permalink: httpDestinationConnectorResource.resource_permalink
})

check(resGetDestinationConnectorHTTP, {
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpDestinationConnectorResource.name} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpDestinationConnectorResource.name} response connectorResource name matched`]: (r) => r.message.resource.name === httpDestinationConnectorResource.name,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpDestinationConnectorResource.name} response connectorResource state matched STATE_CONNECTED`]: (r) => r.message.resource.connectorState == "STATE_CONNECTED",
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpDestinationConnectorResource.resource_permalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpDestinationConnectorResource.resource_permalink} response connectorResource resource_permalink matched`]: (r) => r.message.resource.resourcePermalink === httpDestinationConnectorResource.resource_permalink,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpDestinationConnectorResource.resource_permalink} response connectorResource state matched STATE_CONNECTED`]: (r) => r.message.resource.connectorState == "STATE_CONNECTED",
});
});
}

export function CheckPipelineResource() {
var httpPipelineResource = {
"name": constant.pipelineResourceName,
"resource_permalink": constant.pipelineResourcePermalink,
"pipeline_state": "STATE_ACTIVE"
}

Expand All @@ -128,26 +132,26 @@ export function CheckPipelineResource() {

check(resCreatePipelineHTTP, {
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response StatusOK": (r) => r.status === grpc.StatusOK,
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response pipeline name matched": (r) => r.message.resource.name == httpPipelineResource.name,
"vdp.controller.v1alpha.ControllerPrivateService/UpdateResource response pipeline resource_permalink matched": (r) => r.message.resource.resourcePermalink == httpPipelineResource.resource_permalink,
});
});

group("Controller API: Get pipeline resource state in etcd", () => {
var resGetPipelineHTTP = clientPrivate.invoke(`vdp.controller.v1alpha.ControllerPrivateService/GetResource`, {
name: httpPipelineResource.name
resource_permalink: httpPipelineResource.resource_permalink
})

check(resGetPipelineHTTP, {
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpPipelineResource.name} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpPipelineResource.name} response pipeline name matched`]: (r) => r.message.resource.name === httpPipelineResource.name,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpPipelineResource.name} response pipeline state matched STATE_ACTIVE`]: (r) => r.message.resource.pipelineState == "STATE_ACTIVE",
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpPipelineResource.resource_permalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpPipelineResource.resource_permalink} response pipeline resource_permalink matched`]: (r) => r.message.resource.resourcePermalink === httpPipelineResource.resource_permalink,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpPipelineResource.resource_permalink} response pipeline state matched STATE_ACTIVE`]: (r) => r.message.resource.pipelineState == "STATE_ACTIVE",
});
});
}

export function CheckServiceResource() {
var httpServiceResource = {
"name": constant.serviceResourceName,
"resource_permalink": constant.serviceResourceName,
"backend_state": "SERVING_STATUS_SERVING"
}

Expand All @@ -168,13 +172,13 @@ export function CheckServiceResource() {

group("Controller API: Get service resource state in etcd", () => {
var resGetServiceHTTP = clientPrivate.invoke(`vdp.controller.v1alpha.ControllerPrivateService/GetResource`, {
name: httpServiceResource.name
resource_permalink: httpServiceResource.resource_permalink
})

check(resGetServiceHTTP, {
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpServiceResource.name} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpServiceResource.name} response service name matched`]: (r) => r.message.resource.name === httpServiceResource.name,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpServiceResource.name} response service state matched STATE_ACTIVE`]: (r) => r.message.resource.backendState == "SERVING_STATUS_SERVING",
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpServiceResource.resource_permalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpServiceResource.resource_permalink} response service name matched`]: (r) => r.message.resource.resourcePermalink === httpServiceResource.resource_permalink,
[`vdp.controller.v1alpha.ControllerPrivateService/GetResource ${httpServiceResource.resource_permalink} response service state matched STATE_ACTIVE`]: (r) => r.message.resource.backendState == "SERVING_STATUS_SERVING",
});
});
}
18 changes: 9 additions & 9 deletions integration-test/grpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,31 @@ export function teardown(data) {
group("Controller API: Delete all resources created by the test", () => {

check(client.invoke(`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource`, {
name: constant.modelResourceName
resource_permalink: constant.modelResourcePermalink
}), {
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.modelResourceName} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.modelResourcePermalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
});

check(client.invoke(`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource`, {
name: constant.sourceConnectorResourceName
resource_permalink: constant.sourceConnectorResourcePermalink
}), {
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.sourceConnectorResourceName} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.sourceConnectorResourcePermalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
});

check(client.invoke(`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource`, {
name: constant.destinationConnectorResourceName
resource_permalink: constant.destinationConnectorResourcePermalink
}), {
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.destinationConnectorResourceName} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.destinationConnectorResourcePermalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
});

check(client.invoke(`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource`, {
name: constant.pipelineResourceName
resource_permalink: constant.pipelineResourcePermalink
}), {
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.pipelineResourceName} response StatusOK`]: (r) => r.status === grpc.StatusOK,
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.pipelineResourcePermalink} response StatusOK`]: (r) => r.status === grpc.StatusOK,
});

check(client.invoke(`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource`, {
name: constant.serviceResourceName
resource_permalink: constant.serviceResourceName
}), {
[`vdp.controller.v1alpha.ControllerPrivateService/DeleteResource ${constant.serviceResourceName} response StatusOK`]: (r) => r.status === grpc.StatusOK,
});
Expand Down
Loading

0 comments on commit dd87766

Please sign in to comment.