diff --git a/.vib/schema-registry/cypress/cypress.json b/.vib/schema-registry/cypress/cypress.json new file mode 100644 index 000000000..db50f2eb1 --- /dev/null +++ b/.vib/schema-registry/cypress/cypress.json @@ -0,0 +1,7 @@ +{ + "baseUrl": "http://localhost", + "responseTimeout": 30000, + "env": { + "compatibilityLevel": "BACKWARD" + } +} diff --git a/.vib/schema-registry/cypress/cypress/fixtures/schema.json b/.vib/schema-registry/cypress/cypress/fixtures/schema.json new file mode 100644 index 000000000..f0ffa4dc9 --- /dev/null +++ b/.vib/schema-registry/cypress/cypress/fixtures/schema.json @@ -0,0 +1,3 @@ +{ + "schema": "{\"type\": \"record\", \"name\": \"User\", \"fields\": [{\"name\": \"name\", \"type\": \"string\"}]}" +} diff --git a/.vib/schema-registry/cypress/cypress/integration/schema_registry_spec.js b/.vib/schema-registry/cypress/cypress/integration/schema_registry_spec.js new file mode 100644 index 000000000..23760bfb0 --- /dev/null +++ b/.vib/schema-registry/cypress/cypress/integration/schema_registry_spec.js @@ -0,0 +1,36 @@ +/// +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); + }); +}); diff --git a/.vib/schema-registry/goss/goss.yaml b/.vib/schema-registry/goss/goss.yaml new file mode 100644 index 000000000..3c6c1ec53 --- /dev/null +++ b/.vib/schema-registry/goss/goss.yaml @@ -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 diff --git a/.vib/schema-registry/goss/vars.yaml b/.vib/schema-registry/goss/vars.yaml new file mode 100644 index 000000000..898f28163 --- /dev/null +++ b/.vib/schema-registry/goss/vars.yaml @@ -0,0 +1,2 @@ +listeners: "http://0.0.0.0:8081" +avroCompatibilityLevel: "backward" diff --git a/.vib/schema-registry/vib-publish.json b/.vib/schema-registry/vib-publish.json index a8c59915c..520d79f4f 100644 --- a/.vib/schema-registry/vib-publish.json +++ b/.vib/schema-registry/vib-publish.json @@ -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": [ { diff --git a/.vib/schema-registry/vib-verify.json b/.vib/schema-registry/vib-verify.json index 9ee1dbf39..9ec31d05e 100644 --- a/.vib/schema-registry/vib-verify.json +++ b/.vib/schema-registry/vib-verify.json @@ -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" + } + } + ] } } }