We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@mostafa Below is the script, i am getting the below error. I do not want to create the schema
import { LoadJKS, TLS_1_2 } from "k6/x/kafka"; import { Writer, Reader, Connection, SchemaRegistry, SCHEMA_TYPE_JSON, SASL_SCRAM_SHA512, KEY, VALUE, TOPIC_NAME_STRATEGY, } from "k6/x/kafka"; import VaultManager from './VaultManager.js'; export let options = { stages: [{ target: 1, duration: '30s' }], }; export const vault = new VaultManager('Platform', 'DEV'); let offset = -1; let partition = 0; let numPartitions = 1; let replicationFactor = 1; let username = ""; let password = ""; let passwordToAccessTrustore = ""; let saslConfig = {}; let writer; let reader; let connection; export function setup() { console.log('Inside setup function '); username = "username", password = "password" } export function initializeCredentials() { console.log('Inside initializeCredentials function'); if (!username || !password || !passwordToAccessTrustore) { username = "username", password = "password" saslConfig = { username: username, password: password, algorithm: SASL_SCRAM_SHA512 }; } } const clientCertPem = vault.getIPaceEnvConfig().getValueFromEnvFor('ROOTDIR') + '/client-cert-0.pem'; const clientKeyPem = vault.getIPaceEnvConfig().getValueFromEnvFor('ROOTDIR') + '/client-key.pem'; const serverCaPem = vault.getIPaceEnvConfig().getValueFromEnvFor('ROOTDIR') + '/server-ca.pem'; export default function(data) { initializeCredentials(); const tlsConfig = { enableTls: true, insecureSkipTlsVerify: false, minVersion: TLS_1_2, clientCertPem: clientCertPem, clientKeyPem: clientKeyPem, serverCaPem: serverCaPem }; const brokers = ["emp-tse-dedicated-ppwe-retina.maersk-digital.net:443"]; const topic = "msk.ipace-dev.comptest.topic.internal.any.v1"; const BasicAuth = { username: "username", password: "password", } const schemaRegistry = new SchemaRegistry({ url: "https://digital.net", basicAuth: BasicAuth, tls: tlsConfig }); const keySchemaObject = schemaRegistry.getSchema({ subject: `${topic}-key`, schemaType: SCHEMA_TYPE_JSON, }); const valueSchemaObject = schemaRegistry.getSchema({ subject: `${topic}-value`, schemaType: SCHEMA_TYPE_JSON, }); writer = new Writer({ brokers: brokers, topic: topic, sasl: saslConfig, partition: partition, tls: tlsConfig, }); reader = new Reader({ brokers: brokers, topic: topic, partition: partition, offset: offset, sasl: saslConfig, tls: tlsConfig, }); connection = new Connection({ address: brokers[0], sasl: saslConfig, tls: tlsConfig, }); let messages = [{ key: schemaRegistry.serialize({ data: { correlationId: "test-id-abc-" + 1, }, schema: keySchemaObject, schemaType: SCHEMA_TYPE_JSON, }), value: schemaRegistry.serialize({ data: { templateId: 5, testId: 4, status: "deactive", message: "Hi, I am testing", }, schema: valueSchemaObject, schemaType: SCHEMA_TYPE_JSON, }), }]; console.log("message", messages); writer.produce({ messages: messages, }); let mesg = reader.consume({ limit: 10, }); // console.log("correlation=====>>>", schemaRegistry.deserialize({ // data: mesg[0].key, // schemaType: SCHEMA_TYPE_JSON, // }).correlationId); console.log("schema------>>>>>", schemaRegistry.deserialize({ data: messages[0].value, schemaType: SCHEMA_TYPE_JSON, })); } export function teardown() { if (writer) writer.close(); if (reader) reader.close(); if (connection) connection.close(); }
Error
ERRO[0007] GoError: Failed to validate JSON against schema, OriginalError: %!w(*jsonschema.ValidationError=&{ file:///Users/arpita.sood/Documents/Maersk_code/schema.json# doesn't validate with file:///Users/arpita.sood/Documents/Maersk_code/schema.json# [0x140016098c0 0x14001609920]}) default at github.com/mostafa/xk6-kafka.(*Kafka).schemaRegistryClientClass.func4 (native) at file:///Users/arpita.sood/Documents/dev_latest/gcss_file.js:131:40(148) executor=shared-iterations scenario=default source=stacktrace
The text was updated successfully, but these errors were encountered:
No branches or pull requests
@mostafa
Below is the script, i am getting the below error.
I do not want to create the schema
Error
The text was updated successfully, but these errors were encountered: