-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored E2E tests to stabilize them
- Loading branch information
Showing
6 changed files
with
117 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
dist/ | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { SchemaRegistry, readAVSC } from '@kafkajs/confluent-schema-registry'; | ||
import { join } from 'path'; | ||
|
||
export class Utils { | ||
public static sleep(ms: number) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
|
||
public static async schemaRegistrySetup() { | ||
const registry = new SchemaRegistry({ host: 'http://localhost:8081/' }); | ||
|
||
// For our other tests we require the schema to already exist | ||
// in schema registry and dont allow uploaded through the nestJS | ||
// application. | ||
const valuePath = join(__dirname, 'e2e', 'app', 'value-schema.avsc'); | ||
const keyPath = join(__dirname, 'e2e', 'app', 'key-schema.avsc'); | ||
const valueSchema = readAVSC(valuePath); | ||
const keySchema = readAVSC(keyPath); | ||
|
||
const valueSchemaResult = await registry.register(valueSchema, { | ||
separator: '-' | ||
}); | ||
const keySchemaResult = await registry.register(keySchema, { | ||
separator: '-' | ||
}); | ||
} | ||
} |