diff --git a/.github/workflows/gateway-api-tests.yml b/.github/workflows/gateway-api-tests.yml index 02a829cf7d76..ee67b54658da 100644 --- a/.github/workflows/gateway-api-tests.yml +++ b/.github/workflows/gateway-api-tests.yml @@ -27,6 +27,11 @@ on: required: false type: boolean default: false + is_kong_oss: + description: 'Run tests for Kong OSS' + required: false + type: boolean + default: false workflow_call: inputs: @@ -53,6 +58,11 @@ on: required: false type: boolean default: false + is_kong_oss: + description: 'Run tests for Kong OSS' + required: false + type: boolean + default: false env: GW_IMAGE: ${{ inputs.control_plane_image || 'kong/kong-gateway-internal:nightly-ubuntu' }} @@ -75,6 +85,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_API_AWS_SECRET_ACCESS_KEY }} VERBOSE_RESPONSE_LOGS: ${{ inputs.enable_verbose_response_logging }} RUN_SPEC: ${{ inputs.target_test || 'all' }} + IS_KONG_OSS: ${{ inputs.is_kong_oss || 'false' }} strategy: fail-fast: false matrix: @@ -118,25 +129,33 @@ jobs: if ${{ contains(env.GW_IMAGE, 'fips') }}; then FIPS_MODE=on; else FIPS_MODE=off; fi; echo "FIPS_MODE=$FIPS_MODE" >> $GITHUB_ENV - if [[ $RUN_SPEC == "smoke" || $RUN_SPEC == "custom-plugins" || $RUN_SPEC == 'all' ]]; then + if [[ $IS_KONG_OSS == "true" ]]; then + RUN_SPEC="oss" + fi + + if [[ $RUN_SPEC == "smoke" || $RUN_SPEC == "custom-plugins" || $RUN_SPEC == 'all' || $RUN_SPEC == 'oss' ]]; then CUSTOM_PLUGIN=true else CUSTOM_PLUGIN=false fi + echo "CUSTOM_PLUGIN_VAR=$CUSTOM_PLUGIN" >> $GITHUB_ENV echo "CUSTOM_PLUGIN is $CUSTOM_PLUGIN" + echo "RUN_SPEC=$RUN_SPEC" >> $GITHUB_ENV + echo "RUN_SPEC" is $RUN_SPEC - name: Start Gateway run: cd gateway-docker-compose-generator && make generate && cat docker-compose.yml && make start_ci env: EE_LICENSE: false + GW_ENTERPRISE: ${{ env.IS_KONG_OSS == 'false' && true || false }} PKI: true - INFLUXDB: true + INFLUXDB: ${{ env.IS_KONG_OSS == 'false' && true || false }} REDIS_MODE: standalone SWAGGER: true GW_HOST: localhost - HCV: true + HCV: ${{ env.IS_KONG_OSS == 'false' && true || false }} JAEGER: true CUSTOM_CONFIG_ALL: "RLA_REDISU: redisuser; RLA_REDISP: redispassword; AWS_REGION: us-east-2; AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}; AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}; GCP_SERVICE_ACCOUNT: '${{ secrets.TEST_API_GCP_SERVICE_ACCOUNT }}'" KEYCLOAK: true @@ -144,7 +163,7 @@ jobs: PROMETHEUS: true WASM: true AZURE_VAULT: true - APP_D: true + APP_D: ${{ env.IS_KONG_OSS == 'false' && true || false }} AZURE_TENANT_ID: ${{ secrets.TEST_API_AZURE_TENANT_ID }} AZURE_CLIENT_ID: ${{ secrets.TEST_API_AZURE_CLIENT_ID }} AZURE_CLIENT_SECRET: ${{ secrets.TEST_API_AZURE_CLIENT_SECRET }} @@ -179,6 +198,8 @@ jobs: npm run test-smoke; elif [[ $RUN_SPEC == 'non-smoke' ]]; then npm run test-non-smoke; + elif [[ $RUN_SPEC == 'oss' ]]; then + npm run test-oss; else TEST_APP=gateway npm run test-spec --spec=$RUN_SPEC; fi diff --git a/spec-ee/kong-api-tests/.env.example b/spec-ee/kong-api-tests/.env.example index 6f2e656ada4e..73a9a859347e 100644 --- a/spec-ee/kong-api-tests/.env.example +++ b/spec-ee/kong-api-tests/.env.example @@ -36,4 +36,7 @@ KONNECT_USER_PASSWORD= APPD_PASSWORD= # Konnect data plane docker image, default is kong/kong-gateway-dev:nightly-ubuntu -KONNECT_DP_IMAGE='kong/kong-gateway-dev:nightly-ubuntu' \ No newline at end of file +KONNECT_DP_IMAGE='kong/kong-gateway-dev:nightly-ubuntu' + +# Whether gateway runs in oss mode or not +IS_KONG_OSS=false \ No newline at end of file diff --git a/spec-ee/kong-api-tests/README.md b/spec-ee/kong-api-tests/README.md index 9e5d86c52fbf..27877a8a5692 100644 --- a/spec-ee/kong-api-tests/README.md +++ b/spec-ee/kong-api-tests/README.md @@ -109,6 +109,8 @@ The default Gateway mode is `classic`. If you want to run tests against `hybrid` GW_MODE=hybrid ``` +If you want to run tests against **Kong OSS**, make sure to set `IS_KONG_OSS=true` in your `.env` file or in the GH workflow that you trigger. + ### Verbose Response Logging `export VERBOSE_RESPONSE_LOGS=false` to disable response logging (default is `true`). @@ -134,6 +136,12 @@ npm run test-spec --spec=service npm run test-smoke ``` +- Kong OSS tests + +```bash +npm run test-oss +``` + - Release package tests Make sure to have `KONG_VERSION` and `KONG_PACKAGE` variables set in your environment.\ diff --git a/spec-ee/kong-api-tests/package.json b/spec-ee/kong-api-tests/package.json index 421175a21cc3..1bdb10212d2e 100644 --- a/spec-ee/kong-api-tests/package.json +++ b/spec-ee/kong-api-tests/package.json @@ -12,7 +12,8 @@ "test-smoke": "TEST_APP=gateway mocha -g @smoke --recursive", "test-non-smoke": "TEST_APP=gateway mocha --invert -g @smoke --recursive", "test-koko": "TEST_APP=koko TEST_ENV=dev mocha -g @koko --recursive", - "test-gke": "TEST_APP=gateway mocha -g @gke --recursive" + "test-gke": "TEST_APP=gateway mocha -g @gke --recursive", + "test-oss": "TEST_APP=gateway mocha -g @oss --recursive" }, "dependencies": { "@kong/kauth-test-utils": "^0.0.23", diff --git a/spec-ee/kong-api-tests/support/config/gateway-vars.ts b/spec-ee/kong-api-tests/support/config/gateway-vars.ts index 97b6ca251989..c073b4981263 100644 --- a/spec-ee/kong-api-tests/support/config/gateway-vars.ts +++ b/spec-ee/kong-api-tests/support/config/gateway-vars.ts @@ -65,6 +65,14 @@ export const isGwHybrid = (): boolean => { return getGatewayMode() === 'hybrid' ? true : false; }; +/** + * Check if current gateway mode is OSS + * @returns {boolean} - true if gateway runs in oss mode + */ +export const isKongOSS = (): boolean => { + return process.env.IS_KONG_OSS === 'true' ? true : false; +}; + /** * Check if gateway is installed natively (package tests) * @returns {boolean} - true if gateway is installed using a package diff --git a/spec-ee/kong-api-tests/support/index.ts b/spec-ee/kong-api-tests/support/index.ts index 4d8a28e36a81..d35af3906909 100644 --- a/spec-ee/kong-api-tests/support/index.ts +++ b/spec-ee/kong-api-tests/support/index.ts @@ -32,6 +32,7 @@ export { isLocalDatabase, vars, isGwNative, + isKongOSS, getKongContainerName, getKongVersion, getDataPlaneDockerImage, diff --git a/spec-ee/kong-api-tests/support/utilities/entities-gateway.ts b/spec-ee/kong-api-tests/support/utilities/entities-gateway.ts index beae55750e1d..68ac39eda846 100644 --- a/spec-ee/kong-api-tests/support/utilities/entities-gateway.ts +++ b/spec-ee/kong-api-tests/support/utilities/entities-gateway.ts @@ -5,6 +5,7 @@ import { logResponse } from './logging'; import { randomString, wait } from './random'; import { retryRequest } from './retry-axios'; import { getNegative } from './negative-axios'; +import { isKongOSS } from '@support'; export const getUrl = (endpoint: string, workspaceNameOrId?: string) => { let basePath = getBasePath({ @@ -615,11 +616,10 @@ export const createPlugin = async ( workspace?: string ) => { - // In Koko we don't set 'default' workspace name in URL - if (isGateway()) { - workspace = workspace ? workspace : 'default' - } else if (isKoko()) { + if(isKoko() || isKongOSS()) { workspace = '' + } else if (isGateway()){ + workspace = workspace ? workspace : 'default' } const endpoint = `${workspace}/plugins`; diff --git a/spec-ee/kong-api-tests/test/gateway/_hooks.ts b/spec-ee/kong-api-tests/test/gateway/_hooks.ts index 4cec08e17da3..3bffd62b9951 100644 --- a/spec-ee/kong-api-tests/test/gateway/_hooks.ts +++ b/spec-ee/kong-api-tests/test/gateway/_hooks.ts @@ -1,4 +1,4 @@ -import { clearAllKongResources, createRedisClient, gatewayAuthHeader, isCI, waitForConfigRebuild } from '@support'; +import { clearAllKongResources, createRedisClient, gatewayAuthHeader, isCI, isKongOSS, waitForConfigRebuild } from '@support'; import { postGatewayEeLicense, deleteGatewayEeLicense, @@ -12,7 +12,8 @@ export const mochaHooks: Mocha.RootHookObject = { const { authHeaderKey, authHeaderValue } = gatewayAuthHeader(); axios.defaults.headers[authHeaderKey] = authHeaderValue; createRedisClient(); - if (isCI()) { + + if (isCI() && !isKongOSS()) { // Gateway for API tests starts without EE_LICENSE in CI, hence, we post license at the beginning of all tests to allow us test the functionality of license endpoint await postGatewayEeLicense(); // Wait for the license propagation to complete before release to the test @@ -29,7 +30,8 @@ export const mochaHooks: Mocha.RootHookObject = { afterAll: async function (this: Mocha.Context) { // Gateway for API tests starts without EE_LICENSE in CI, hence, we delete license at the end of all tests to allow test rerun from clean state - if (isCI()) { + // Skipping this step for OSS tests + if (isCI() && !isKongOSS()) { await deleteGatewayEeLicense(); } }, diff --git a/spec-ee/kong-api-tests/test/gateway/admin-api/key-sets.spec.ts b/spec-ee/kong-api-tests/test/gateway/admin-api/key-sets.spec.ts index 622314364e5e..dc944149617d 100644 --- a/spec-ee/kong-api-tests/test/gateway/admin-api/key-sets.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/admin-api/key-sets.spec.ts @@ -9,7 +9,7 @@ import { isGateway, } from '@support'; -describe('@gke: Gateway Admin API: Key-Sets For jwe-decrypt plugin', function () { +describe('@gke @oss: Gateway Admin API: Key-Sets For jwe-decrypt plugin', function () { const url = `${getBasePath({ environment: isGateway() ? Environment.gateway.admin : undefined, })}/key-sets`; diff --git a/spec-ee/kong-api-tests/test/gateway/admin-api/keys.spec.ts b/spec-ee/kong-api-tests/test/gateway/admin-api/keys.spec.ts index 9c008be56eb9..f4e2fda98a8b 100644 --- a/spec-ee/kong-api-tests/test/gateway/admin-api/keys.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/admin-api/keys.spec.ts @@ -70,7 +70,7 @@ describe('@gke: Gateway Admin API: Keys For jwe-decrypt plugin', function () { expect( resp.data.fields.pem, 'Should indicate public key field is missing' - ).to.match(/could not load public key.+/); + ).to.match(/could not load public key/); }); it('should not create keys if private key field violates schema', async function () { diff --git a/spec-ee/kong-api-tests/test/gateway/admin-api/router.spec.ts b/spec-ee/kong-api-tests/test/gateway/admin-api/router.spec.ts index 439482d5136d..22c9b23b388a 100644 --- a/spec-ee/kong-api-tests/test/gateway/admin-api/router.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/admin-api/router.spec.ts @@ -27,6 +27,7 @@ import { eventually, isFipsMode, isGwNative, + isKongOSS } from '@support'; const agent = new https.Agent({ @@ -51,7 +52,7 @@ const currentHost = getGatewayHost(); const isLocalDb = isLocalDatabase(); -describe('@smoke @koko @gke: Router Functionality Tests', function () { +describe('@smoke @koko @gke @oss: Router Functionality Tests', function () { const proxyUrl = `${getBasePath({ app: 'gateway', environment: Environment.gateway.proxySec, @@ -92,39 +93,35 @@ describe('@smoke @koko @gke: Router Functionality Tests', function () { name: serviceReq.name, }; - const workspaceReq = await axios({ - method: 'POST', - url: `${adminUrl}/workspaces`, - data: { - name: randomString(), - }, - validateStatus: null, - }); - - expect(workspaceReq.status, 'Status should be 201').equal(201); - workspaceName = workspaceReq.data.name; - - //create service in new workspace - const serviceReq2 = await axios({ - method: 'POST', - url: `${adminUrl}/${workspaceName}/services`, - data: { - name: serviceName2, - url: 'http://mockbin.org', - }, - }) - logResponse(serviceReq2); - - service2Details = { - id: serviceReq2.data.id, - name: serviceReq2.data.name, - }; - - const resp = await axios({ - method: 'get', - url: `${adminUrl}/services/${serviceDetails.id}/routes`, - }); - logResponse(resp); + if (!isKongOSS() && !isKoko()) { + const workspaceReq = await axios({ + method: 'POST', + url: `${adminUrl}/workspaces`, + data: { + name: randomString(), + }, + validateStatus: null, + }); + + expect(workspaceReq.status, 'Status should be 201').equal(201); + workspaceName = workspaceReq.data.name; + + //create service in new workspace + const serviceReq2 = await axios({ + method: 'POST', + url: `${adminUrl}/${workspaceName}/services`, + data: { + name: serviceName2, + url: 'http://mockbin.org', + }, + }) + logResponse(serviceReq2); + + service2Details = { + id: serviceReq2.data.id, + name: serviceReq2.data.name, + }; + } }); it('should create a route with header', async function () { @@ -451,37 +448,39 @@ describe('@smoke @koko @gke: Router Functionality Tests', function () { }); } - it('should perform route validation when creating a duplicate route in a different workspace', async function () { - // duplicate routes cannot be created when route validation is on - const resp = await axios({ - method: 'post', - url: `${adminUrl}/services/${serviceDetails.id}/routes`, - data: { - ...routePayload, - name: routePayload.name, - }, - validateStatus: null, - }); - expect(resp.status, 'Status should be 201').to.equal(201); - - waitForConfigRebuild(); - - // attempt to create route in second workspace - const respRepeat = await axios({ - method: 'post', - url: `${adminUrl}/${workspaceName}/services/${service2Details.id}/routes`, - data: { - ...routePayload, - name: routePayload.name, - }, - validateStatus: null, - }); - logResponse(respRepeat); - expect(respRepeat.status, 'Status should be 409').to.equal(409); - expect(respRepeat.data.message, 'Should have correct error message').to.equal('API route collides with an existing API'); - }) - - if(!isGwNative() && !isFipsMode()) { + if((!isGwNative() || !isFipsMode()) && (!isKongOSS() && !isKoko())) { + // skip workspace related tests for OSS as workspace is not supported in oss mode + it('should perform route validation when creating a duplicate route in a different workspace', async function () { + // duplicate routes cannot be created when route validation is on + const resp = await axios({ + method: 'post', + url: `${adminUrl}/services/${serviceDetails.id}/routes`, + data: { + ...routePayload, + name: routePayload.name, + }, + validateStatus: null, + }); + expect(resp.status, 'Status should be 201').to.equal(201); + + await eventually(async () => { + // attempt to create route in second workspace + const respRepeat = await axios({ + method: 'post', + url: `${adminUrl}/${workspaceName}/services/${service2Details.id}/routes`, + data: { + ...routePayload, + name: routePayload.name, + }, + validateStatus: null, + }); + + logResponse(respRepeat); + expect(respRepeat.status, 'Status should be 409').to.equal(409); + expect(respRepeat.data.message, 'Should have correct error message').to.equal('API route collides with an existing API'); + }) + }) + it('should update router to not perform route validation', async function () { await resetGatewayContainerEnvVariable({ KONG_ROUTE_VALIDATION_STRATEGY: 'off' }, kongContainerName); if (isHybrid) { @@ -528,19 +527,22 @@ describe('@smoke @koko @gke: Router Functionality Tests', function () { headers: { testHeader: 'test' }, }); logResponse(resp); - expect(resp.status, 'Status should be 200').to.equal(200); - }) + expect(resp.status, 'Status should be 200').to.equal(200); + }) } after(async function () { await clearAllKongResources(); await clearAllKongResources(workspaceName); - await deleteWorkspace(workspaceName); - if(!isGwNative() && !isFipsMode()) { - await resetGatewayContainerEnvVariable({ KONG_ROUTE_VALIDATION_STRATEGY: 'smart' }, kongContainerName); - // reset data plane - if (isHybrid) { - await resetGatewayContainerEnvVariable({ KONG_ROUTE_VALIDATION_STRATEGY: 'smart' }, 'kong-dp1'); + if (!isKongOSS() && !isKoko()) { + await deleteWorkspace(workspaceName); + + if((!isGwNative() || !isFipsMode())) { + await resetGatewayContainerEnvVariable({ KONG_ROUTE_VALIDATION_STRATEGY: 'smart' }, kongContainerName); + // reset data plane + if (isHybrid) { + await resetGatewayContainerEnvVariable({ KONG_ROUTE_VALIDATION_STRATEGY: 'smart' }, 'kong-dp1'); + } } } }); diff --git a/spec-ee/kong-api-tests/test/gateway/admin-api/routes.spec.ts b/spec-ee/kong-api-tests/test/gateway/admin-api/routes.spec.ts index bad730e91187..c27365938d3a 100644 --- a/spec-ee/kong-api-tests/test/gateway/admin-api/routes.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/admin-api/routes.spec.ts @@ -10,11 +10,12 @@ import { randomString, deleteGatewayService, wait, - eventually + eventually, + isKongOSS } from '@support'; import axios, { AxiosResponse } from 'axios'; -describe('@smoke @gke: Gateway Admin API: Routes', function () { +describe('@smoke @gke @oss: Gateway Admin API: Routes', function () { let serviceId: string let routeId: string; @@ -44,6 +45,8 @@ describe('@smoke @gke: Gateway Admin API: Routes', function () { strip_path: true, preserve_host: false, }; + + const isGwOSS = isKongOSS(); const assertRespDetails = (response: AxiosResponse) => { const resp = response.data; @@ -71,8 +74,12 @@ describe('@smoke @gke: Gateway Admin API: Routes', function () { expect(resp.data.name, 'Should have correct service name').equal( servicePayload.name ); - expect(resp.headers, 'Should include request id in header').to.have.property('x-kong-admin-request-id'); - expect(resp.headers['x-kong-admin-request-id'], 'request id should be a string').to.be.a('string') + + if (!isGwOSS) { + expect(resp.headers, 'Should include request id in header').to.have.property('x-kong-admin-request-id'); + expect(resp.headers['x-kong-admin-request-id'], 'request id should be a string').to.be.a('string') + } + serviceId = resp.data.id }); diff --git a/spec-ee/kong-api-tests/test/gateway/admin-api/service.spec.ts b/spec-ee/kong-api-tests/test/gateway/admin-api/service.spec.ts index 54c449039346..5c5cbb87f87a 100644 --- a/spec-ee/kong-api-tests/test/gateway/admin-api/service.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/admin-api/service.spec.ts @@ -15,7 +15,7 @@ import { } from '@support'; import axios, { AxiosResponse } from 'axios'; -describe('@smoke @koko @gke: Gateway Admin API: Services', function () { +describe('@smoke @koko @gke @oss: Gateway Admin API: Services', function () { let url: string let serviceId: string let routeId: string; diff --git a/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/cert-upstreams.spec.ts b/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/cert-upstreams.spec.ts index ab5c824af023..ca799f6c6004 100644 --- a/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/cert-upstreams.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/cert-upstreams.spec.ts @@ -10,7 +10,7 @@ import { } from '@support'; import axios from 'axios'; -describe('@gke: Gateway Admin API: Cert-Associated Upstreams', function () { +describe('@gke @oss: Gateway Admin API: Cert-Associated Upstreams', function () { const url = `${getBasePath({ environment: isGateway() ? Environment.gateway.admin : undefined, })}/certificates`; diff --git a/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/targets.spec.ts b/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/targets.spec.ts index 0e712993e3b2..b7e8e9c3f037 100644 --- a/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/targets.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/targets.spec.ts @@ -12,7 +12,7 @@ import { } from '@support'; import axios from 'axios'; -describe('@gke: Gateway Admin API: Targets', function () { +describe('@gke @oss: Gateway Admin API: Targets', function () { const url = `${getBasePath({ environment: isGateway() ? Environment.gateway.admin : undefined, })}/upstreams`; diff --git a/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/upstreams.spec.ts b/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/upstreams.spec.ts index ffa4c8e81f40..f18772ebc5bf 100644 --- a/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/upstreams.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/admin-api/upstreams/upstreams.spec.ts @@ -9,7 +9,7 @@ import { } from '@support'; import axios from 'axios'; -describe('@smoke @gke: Gateway Admin API: Upstreams', function () { +describe('@smoke @gke @oss: Gateway Admin API: Upstreams', function () { const url = `${getBasePath({ environment: isGateway() ? Environment.gateway.admin : undefined, })}/upstreams`; diff --git a/spec-ee/kong-api-tests/test/gateway/deck.spec.ts b/spec-ee/kong-api-tests/test/gateway/deck.spec.ts index 6561c2f385cf..950a4a841bf2 100644 --- a/spec-ee/kong-api-tests/test/gateway/deck.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/deck.spec.ts @@ -22,7 +22,7 @@ import { const adminUrl = `${getBasePath({ environment: isGateway() ? Environment.gateway.admin : undefined })}`; const deckFileName = 'kong.json'; -describe('decK: Sanity Tests', function () { +describe('@oss: decK: Sanity Tests', function () { const name = randomString(); before(async function () { diff --git a/spec-ee/kong-api-tests/test/gateway/expressions-router.spec.ts b/spec-ee/kong-api-tests/test/gateway/expressions-router.spec.ts index 34e098b670aa..2de5b180f13e 100644 --- a/spec-ee/kong-api-tests/test/gateway/expressions-router.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/expressions-router.spec.ts @@ -13,7 +13,7 @@ import { getKongContainerName, } from '@support'; -describe('Expressions Router Tests', function () { +describe('@oss: Expressions Router Tests', function () { const serviceName = 'expressionsService'; const simpleExpression = '(http.path == "/first_path") || (http.path == "/second_path")'; const simpleExpressionUpdate = encodeURIComponent('(http.path == "/third_path" && http.method == "PUT")'); diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/acme.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/acme.spec.ts index 11a18913b22c..f713bc8238fa 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/acme.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/acme.spec.ts @@ -28,8 +28,8 @@ import axios from 'axios'; * IMPORTANT NOTE * For this test to work, you need to add '127.0.0.1 domain.test' to your /etc/hosts file */ -describe('Gateway Plugins: ACME', function () { - console.info(`Don't forget to add '127.0.0.1 domain.test' to your /etc/hosts file`) +describe('@oss: Gateway Plugins: ACME', function () { + console.info(`Don't forget to add '127.0.0.1 domain.test' to your /etc/hosts file for ACME tests to work`); let serviceId: string; diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/basic-auth-instance-name.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/basic-auth-instance-name.spec.ts index 6261273ad886..ba108edf6633 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/basic-auth-instance-name.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/basic-auth-instance-name.spec.ts @@ -19,7 +19,7 @@ import { } from '@support'; import axios from 'axios'; -describe('@gke: Gateway Plugins: basic-auth using plugin instance name', function () { +describe('@gke @oss: Gateway Plugins: basic-auth using plugin instance name', function () { const path = '/basic-auth'; const serviceName = 'basic-auth-service'; const isHybrid = isGwHybrid(); diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/cors.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/cors.spec.ts index 8d798da0038c..1975af4944ae 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/cors.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/cors.spec.ts @@ -15,7 +15,7 @@ import { eventually, } from '@support'; -describe('@gke: Gateway Plugins: CORS', function () { +describe('@gke @oss: Gateway Plugins: CORS', function () { const url = `${getBasePath({ environment: isGateway() ? Environment.gateway.admin : undefined, })}/plugins`; diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/custom-plugins.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/custom-plugins.spec.ts index fde1dc6515ba..53c9a5c9f76b 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/custom-plugins.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/custom-plugins.spec.ts @@ -21,7 +21,7 @@ const isPackageTest = isGwNative(); const currentDockerImage = getControlPlaneDockerImage(); // skip custom plugin tests for amazonlinux-2 distro and for package tests -((currentDockerImage?.endsWith('amazonlinux-2') || isPackageTest) ? describe.skip : describe)('@smoke: Gateway Custom Plugins: js-hello, go-hello', function () { +((currentDockerImage?.endsWith('amazonlinux-2') || isPackageTest) ? describe.skip : describe)('@smoke @oss: Gateway Custom Plugins: js-hello, go-hello', function () { const url = `${getBasePath({ environment: isGateway() ? Environment.gateway.admin : undefined, })}/plugins`; diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/file-log.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/file-log.spec.ts index d9f8d7f5e436..a8107ad8efa6 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/file-log.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/file-log.spec.ts @@ -23,9 +23,10 @@ import { wait, waitForConfigRebuild, checkLogPropertyAndValue, + isKongOSS, } from '@support'; -describe('Gateway Plugins: file-log', function () { +describe('@oss: Gateway Plugins: file-log', function () { const gwContainerName = isGwHybrid() ? 'kong-dp1' : getKongContainerName(); const logFolder = `tmp/`; const fixLogFileName = `file-log.log`; @@ -114,8 +115,11 @@ describe('Gateway Plugins: file-log', function () { routeId = route.id; const consumer = await createConsumer(consumerName); consumerId = consumer.id; - const consumerGroup = await createConsumerGroup(consumerGroupName); - consumerGroupId = consumerGroup.id + + if(!isKongOSS()) { + const consumerGroup = await createConsumerGroup(consumerGroupName); + consumerGroupId = consumerGroup.id + } await waitForConfigRebuild(); basePayload = { @@ -336,14 +340,16 @@ describe('Gateway Plugins: file-log', function () { pluginId = resp.data.id; }); - it('should not be able to enable file-log plugin in consumer group level', async function () { - basePayload.consumer_group = { id: consumerGroupId }; - const resp = await postNegative(pluginUrl, basePayload); - logResponse(resp); - - expect(resp.status, 'Status should be 400').to.equal(400); - expect(resp.data.message, 'Should have correct error message').to.contain('consumer_group: value must be null'); - }); + if (!isKongOSS()) { + it('should not be able to enable file-log plugin in consumer group level', async function () { + basePayload.consumer_group = { id: consumerGroupId }; + const resp = await postNegative(pluginUrl, basePayload); + logResponse(resp); + + expect(resp.status, 'Status should be 400').to.equal(400); + expect(resp.data.message, 'Should have correct error message').to.contain('consumer_group: value must be null'); + }); + } after(async function () { await clearAllKongResources(); diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/grpc-gateway.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/grpc-gateway.spec.ts index 4e232be9f36f..c9d3a4d61096 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/grpc-gateway.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/grpc-gateway.spec.ts @@ -15,7 +15,7 @@ import { isGateway, } from '@support'; -describe('Gateway Plugins: gRPC-gateway', function () { +describe('@oss: Gateway Plugins: gRPC-gateway', function () { const grpcUrl = 'grpc://grpcbin:9000'; const grpcSecureUrl = 'grpcs://grpcbin:9001'; const protoFile = 'hello-gateway.proto'; diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/grpc-web.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/grpc-web.spec.ts index 09a589c18473..b1c8be215dc8 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/grpc-web.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/grpc-web.spec.ts @@ -15,7 +15,7 @@ import { isGateway, } from '@support'; -describe('Gateway Plugins: gRPC-web', function () { +describe('@oss: Gateway Plugins: gRPC-web', function () { const grpcUrl = 'grpc://grpcbin:9000'; const grpcSecureUrl = 'grpcs://grpcbin:9001'; const protoFile = 'hello.proto'; diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/http-log.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/http-log.spec.ts index 27c38eae3a05..678de6609cd1 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/http-log.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/http-log.spec.ts @@ -17,7 +17,7 @@ import { isGateway } from '@support'; -describe('Gateway Plugins: http-log', function () { +describe('@oss: Gateway Plugins: http-log', function () { const path = `/${randomString()}`; let serviceId: string; diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/jwt.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/jwt.spec.ts index a9019e9ca849..eed031b52945 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/jwt.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/jwt.spec.ts @@ -18,7 +18,7 @@ import { waitForConfigRebuild, } from '@support'; -describe('Gateway Plugins: jwt', function () { +describe('@oss: Gateway Plugins: jwt', function () { const path = '/jwt'; const serviceName = 'jwt-service'; const algorithms = ['ES512', 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'ES256', 'ES384']; diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/key-auth.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/key-auth.spec.ts index 54492d4e8b7c..7317d18a7952 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/key-auth.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/key-auth.spec.ts @@ -18,7 +18,7 @@ import { } from '@support'; import axios from 'axios'; -describe('@smoke @koko: Gateway Plugins: key-auth', function () { +describe('@smoke @koko @oss: Gateway Plugins: key-auth', function () { const path = '/key-auth'; const serviceName = 'key-auth-service'; const consumerName = 'bill'; diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/opentelemetry.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/opentelemetry.spec.ts index 5a9b30c2c37c..8e641105e607 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/opentelemetry.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/opentelemetry.spec.ts @@ -21,7 +21,7 @@ import { retryRequest, } from '@support'; -describe('Gateway Plugins: OpenTelemetry', function () { +describe('@oss: Gateway Plugins: OpenTelemetry', function () { this.timeout(50000); const isHybrid = isGwHybrid(); diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/otel-logs.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/otel-logs.spec.ts index 4ec378d66cba..fd067a9e253a 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/otel-logs.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/otel-logs.spec.ts @@ -24,7 +24,7 @@ import { deleteTargetFile, } from '@support'; -describe('Gateway Plugins: OpenTelemetry Logs', function () { +describe('@oss: Gateway Plugins: OpenTelemetry Logs', function () { const isHybrid = isGwHybrid(); const gwContainerName = getKongContainerName(); const otelColContainerName = 'opentelemetry-collector' diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/prometheus.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/prometheus.spec.ts index 383dab143207..9eb7fc829550 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/prometheus.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/prometheus.spec.ts @@ -22,10 +22,11 @@ import { deletePlugin, deleteConsumer, wait, - createPolly + createPolly, + isKongOSS } from '@support'; -describe('Gateway Plugins: Prometheus', function () { +describe('@oss: Gateway Plugins: Prometheus', function () { const serviceName = 'prometheus-service'; const routeName = 'prometheus-route'; const routePath = '/api-prom' @@ -115,29 +116,32 @@ describe('Gateway Plugins: Prometheus', function () { await waitForConfigRebuild(); }); - it('should see kong_db_entities_total metric after enabling prometheus plugin', async function () { - await eventually(async () => { - let resp: any - // the initial metrics differ in case of traditional and hybrid gateway modes - // here we assert that a metric exists which is unique to each gateway mode - if(isGwHybrid()) { - resp = await queryPrometheusMetrics('kong_data_plane_version_compatible') - } else { - resp = await queryPrometheusMetrics('kong_db_entities_total') - } - - expect(JSON.parse(resp.result[0].value[1]), 'should kong_db_entities_total number').to.be.gte(1) + // below 2 metrics are enterprise only + if(!isKongOSS()) { + it('should see kong_db_entities_total metric after enabling prometheus plugin', async function () { + await eventually(async () => { + let resp: any + // the initial metrics differ in case of traditional and hybrid gateway modes + // here we assert that a metric exists which is unique to each gateway mode + if(isGwHybrid()) { + resp = await queryPrometheusMetrics('kong_data_plane_version_compatible') + } else { + resp = await queryPrometheusMetrics('kong_db_entities_total') + } + + expect(JSON.parse(resp.result[0].value[1]), 'should kong_db_entities_total number').to.be.gte(1) + }); }); - }); - it('should see kong_enterprise_license_features metric after enabling prometheus plugin', async function () { - await eventually(async () => { - const resp = await queryPrometheusMetrics('kong_enterprise_license_features') - expect(resp.result.length).to.equal(2) - expect(resp.result[0].metric.feature).to.equal("ee_entity_read") - expect(resp.result[1].metric.feature).to.equal("ee_entity_write") + it('should see kong_enterprise_license_features metric after enabling prometheus plugin', async function () { + await eventually(async () => { + const resp = await queryPrometheusMetrics('kong_enterprise_license_features') + expect(resp.result.length).to.equal(2) + expect(resp.result[0].metric.feature).to.equal("ee_entity_read") + expect(resp.result[1].metric.feature).to.equal("ee_entity_write") + }); }); - }); + } it('should enable the prometheus plugin latency_metrics', async function () { pluginPayload = { ...pluginPayload, config: { latency_metrics: true } } diff --git a/spec-ee/kong-api-tests/test/gateway/plugins/standard-webhooks.spec.ts b/spec-ee/kong-api-tests/test/gateway/plugins/standard-webhooks.spec.ts index 59401326faed..8f6831dc57d7 100644 --- a/spec-ee/kong-api-tests/test/gateway/plugins/standard-webhooks.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/plugins/standard-webhooks.spec.ts @@ -15,7 +15,7 @@ import { eventually } from '@support'; -describe('Gateway Plugins: standard webhooks', function () { +describe('@oss: Gateway Plugins: standard webhooks', function () { this.timeout(50000) const path = '/wh'; const serviceName = 'webhook-service'; diff --git a/spec-ee/kong-api-tests/test/gateway/status-endpoint.spec.ts b/spec-ee/kong-api-tests/test/gateway/status-endpoint.spec.ts index a5fbc1351727..88fd6dc3573c 100644 --- a/spec-ee/kong-api-tests/test/gateway/status-endpoint.spec.ts +++ b/spec-ee/kong-api-tests/test/gateway/status-endpoint.spec.ts @@ -21,7 +21,7 @@ const isPackageTest = isGwNative(); // skip tests for package mode due to failures in the last test // needs to be investigated why the kong-ee-database throws cert access denied error and doesn't start -(isPackageTest ? describe.skip : describe)('/status Endpoint tests', function () { +(isPackageTest ? describe.skip : describe)('@oss: /status Endpoint tests', function () { before(async function () { if (!isLocalDb) { this.skip();