Skip to content
New issue

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

upgrading dockest to 2.1.0 #94

Merged
merged 9 commits into from
Apr 13, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ release
# website
#
build

# test
docker-compose.dockest-generated.yml
dockest-error.json
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: '3.8'

services:
kafka: # https://hub.docker.com/r/confluentinc/cp-kafka
Expand Down Expand Up @@ -32,3 +32,5 @@ services:

avro_tools: # https://hub.docker.com/r/coderfi/avro-tools
image: coderfi/avro-tools:1.7.7
ports:
- '9999:9999'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to expose this port for avro-tools?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bug in dockest I believe where the docker-compose must define a port. I'll look into the root cause and see if there is a workaround that doesn't require this hack.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikengervall is this something I should address in dockest, or is there a known workaround?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikengervall is this something I should address in dockest, or is there a known workaround?

Hey! There's even a version 3.0.0 of Dockest in the making which will include a number of improvements. Can't tell exactly what the ETA is, but there's a few PRs queued to be merged and some beta testing required before we can release.

I'll look into the root cause and see if there is a workaround that doesn't require this hack.

I'd say this port-hack is okay for now, I could circle back to this piece of code once Dockest v3 is out and this has been addressed 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, ill take a look as well.

67 changes: 23 additions & 44 deletions dockest.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,30 @@
import { default as Dockest, runners, logLevel } from 'dockest'
import { Dockest, sleepWithLog, logLevel } from 'dockest'
import { DockestService } from 'dockest/dist/@types'

const { ZooKeeperRunner, SimpleRunner, KafkaRunner } = runners

const zooKeeperRunner = new ZooKeeperRunner({
service: 'zooKeeper',
ports: {
[ZooKeeperRunner.DEFAULT_PORT]: ZooKeeperRunner.DEFAULT_PORT,
},
})

/**
* Debug SchemaRegistry with CURL: https://docs.confluent.io/2.0.0/schema-registry/docs/intro.html
*/
const schemaRegistryRunner = new SimpleRunner({
service: 'schemaRegistry',
image: 'confluentinc/cp-schema-registry:5.3.0',
ports: {
'8982': '8081',
},
environment: {
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: `${zooKeeperRunner.runnerConfig.service}:${ZooKeeperRunner.DEFAULT_PORT}`,
SCHEMA_REGISTRY_HOST_NAME: 'localhost',
},
})

const kafkaRunner = new KafkaRunner({
service: 'kafka',
image: 'confluentinc/cp-kafka:5.2.2',
dependsOn: [zooKeeperRunner],
ports: {
[KafkaRunner.DEFAULT_PORT_PLAINTEXT]: KafkaRunner.DEFAULT_PORT_PLAINTEXT,
const dockest = new Dockest({
composeFile: 'docker-compose.yml',
dumpErrors: true,
jestLib: require('jest'),
jestOpts: {
updateSnapshot: true,
},
logLevel: logLevel.DEBUG,
})

const dockest = new Dockest({
runners: [kafkaRunner, schemaRegistryRunner],
jest: {
lib: require('jest'),
verbose: true,
const dockestServices: DockestService[] = [
{
serviceName: 'zooKeeper',
dependents: [
{
serviceName: 'kafka',
readinessCheck: () => sleepWithLog(10, `Sleeping for Kafka`),
},
],
},
opts: {
logLevel: logLevel.DEBUG,
afterSetupSleep: 35,
dev: {
debug: process.argv[2] === 'debug' || process.argv[2] === 'dev',
},
{
serviceName: 'schemaRegistry',
readinessCheck: () => sleepWithLog(35, `Sleeping for Schema Registry`),
},
})
]

dockest.run()
dockest.run(dockestServices)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@typescript-eslint/eslint-plugin": "^2.1.0",
"@typescript-eslint/parser": "^2.1.0",
"@typescript-eslint/typescript-estree": "^2.1.0",
"dockest": "^1.0.3",
"dockest": "^2.1.0",
"eslint": "^6.3.0",
"eslint-config-prettier": "^6.1.0",
"eslint-plugin-no-only-tests": "^2.3.1",
Expand Down