[bitnami/schema-registry] Add Goss/Cypress tests (#11578)

* [bitnami/schema-registry] Add Goss/Cypress tests

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Add goss/vars.yaml

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Apply suggestions

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Apply new suggestions

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Revert back to Cypress.env but use cypress.json

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>

* Fix import

Signed-off-by: Miguel Ruiz <miruiz@vmware.com>
This commit is contained in:
Miguel Ruiz
2022-08-09 11:15:00 +02:00
committed by GitHub
parent 81d7f0f783
commit f52ef4b2d0
7 changed files with 152 additions and 0 deletions
@@ -0,0 +1,7 @@
{
"baseUrl": "http://localhost",
"responseTimeout": 30000,
"env": {
"compatibilityLevel": "BACKWARD"
}
}
@@ -0,0 +1,3 @@
{
"schema": "{\"type\": \"record\", \"name\": \"User\", \"fields\": [{\"name\": \"name\", \"type\": \"string\"}]}"
}
@@ -0,0 +1,36 @@
/// <reference types="cypress" />
import body from '../fixtures/schema.json';
it('can access the API and obtain global compatibility level', () => {
cy.request({
method: 'GET',
url: '/config',
form: true,
}).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.compatibilityLevel).to.contain(Cypress.env('compatibilityLevel'));
});
});
it('can create a new schema and subject', () => {
const newSubject = 'test';
cy.request({
method: 'POST',
headers: { 'Content-Type': 'application/vnd.schemaregistry.v1+json' },
url: `/subjects/${newSubject}/versions`,
body: body,
}).then((response) => {
expect(response.status).to.eq(200);
expect(response.body.id).to.eq(1);
});
cy.request({
method: 'GET',
url: '/subjects',
form: true,
}).then((response) => {
expect(response.status).to.eq(200);
expect(response.body).to.have.length(1);
expect(response.body).to.include(newSubject);
});
});
+12
View File
@@ -0,0 +1,12 @@
file:
/opt/bitnami/schema-registry/etc/schema-registry/schema-registry.properties:
mode: "0664"
filetype: file
exists: true
contains:
- "listeners = {{ .Vars.listeners }}"
- "avro.compatibility.level = {{ .Vars.avroCompatibilityLevel }}"
/var/run/secrets/kubernetes.io/serviceaccount:
mode: "3777"
filetype: directory
exists: true
+2
View File
@@ -0,0 +1,2 @@
listeners: "http://0.0.0.0:8081"
avroCompatibilityLevel: "backward"
+46
View File
@@ -16,6 +16,52 @@
}
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/schema-registry"
},
"runtime_parameters": "c2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCmF2cm9Db21wYXRpYmlsaXR5TGV2ZWw6IGJhY2t3YXJkCgo=",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "S4"
}
}
},
"actions": [
{
"action_id": "health-check",
"params": {
"endpoint": "lb-schema-registry-http",
"app_protocol": "HTTP"
}
},
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib/schema-registry/goss"
},
"remote": {
"workload": "sts-schema-registry"
},
"vars_file": "vars.yaml"
}
},
{
"action_id": "cypress",
"params": {
"resources": {
"path": "/.vib/schema-registry/cypress"
},
"endpoint": "lb-schema-registry-http",
"app_protocol": "HTTP"
}
}
]
},
"publish": {
"actions": [
{
+46
View File
@@ -15,6 +15,52 @@
"action_id": "helm-lint"
}
]
},
"verify": {
"context": {
"resources": {
"url": "{SHA_ARCHIVE}",
"path": "/bitnami/schema-registry"
},
"runtime_parameters": "c2VydmljZToKICB0eXBlOiBMb2FkQmFsYW5jZXIKICBwb3J0czoKICAgIGh0dHA6IDgwCmF2cm9Db21wYXRpYmlsaXR5TGV2ZWw6IGJhY2t3YXJkCgo=",
"target_platform": {
"target_platform_id": "{VIB_ENV_TARGET_PLATFORM}",
"size": {
"name": "S4"
}
}
},
"actions": [
{
"action_id": "health-check",
"params": {
"endpoint": "lb-schema-registry-http",
"app_protocol": "HTTP"
}
},
{
"action_id": "goss",
"params": {
"resources": {
"path": "/.vib/schema-registry/goss"
},
"remote": {
"workload": "sts-schema-registry"
},
"vars_file": "vars.yaml"
}
},
{
"action_id": "cypress",
"params": {
"resources": {
"path": "/.vib/schema-registry/cypress"
},
"endpoint": "lb-schema-registry-http",
"app_protocol": "HTTP"
}
}
]
}
}
}