Skip to content

Commit

Permalink
MInor fixes
Browse files Browse the repository at this point in the history
- Update ssl related code and nest it into describes
- Updates tests to support new broker version
- Update docker-compose to create topics
- fix check
  • Loading branch information
Argonus committed Apr 21, 2022
1 parent 9ad7bd4 commit 788813b
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 190 deletions.
86 changes: 46 additions & 40 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,55 @@ jobs:
erlang: ['24.3']

steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- name: Setup elixir & erlang enviroment
uses: actions/setup-elixir@v1
with:
elixir-version: ${{matrix.elixir}} # Define the elixir version [required]
otp-version: ${{matrix.erlang}} # Define the OTP version [required]
experimental-otp: true # More info https://github.com/actions/setup-elixir/issues/31
- name: Retrieve cached dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
- name: Install dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- name: Setup elixir & erlang enviroment
uses: actions/setup-elixir@v1
with:
elixir-version: ${{matrix.elixir}} # Define the elixir version [required]
otp-version: ${{matrix.erlang}} # Define the OTP version [required]
experimental-otp: true # More info https://github.com/actions/setup-elixir/issues/31

- name: Retrieve Mix Dependencies Cache
uses: actions/cache@v2
id: mix-cache # id to use in retrieve action
with:
path: deps
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- name: Retrieve Mix Dependencies Compilation Cache
uses: actions/cache@v2
id: mix-deps-compile-cache # id to use in retrieve action
with:
path: _build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-deps-compile-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Mix Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Compile Mix Dependencies
if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true'
run: mix deps.compile

run-checks:
name: check
runs-on: ubuntu-20.04
needs: [setup]
needs: [dependencies]
env:
MIX_ENV: dev

strategy:
fail-fast: false
matrix:
include:
- elixir: 1.10.2
erlang: 22.3
checks:
- mix credo
- mix compile --warnings-as-errors --force
- mix format --check-formatted
elixir: ['1.12.3']
erlang: ['24.3']

steps:
- uses: actions/checkout@v2
Expand All @@ -88,20 +92,22 @@ jobs:
path: _build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-deps-compile-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

- run: ${{ matrix.checks }}
- run: |
mix credo
mix compile --warnings-as-errors --force
mix format --check-formatted
dialyzer:
name: check / dialyzer
needs: [setup]
needs: [dependencies]
runs-on: ubuntu-latest
env:
MIX_ENV: dev

strategy:
matrix:
include:
- elixir: 1.10.2
erlang: 22.3
elixir: ['1.12.3']
erlang: ['24.3']

steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 6 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ services:
- ./ssl/kafka.server.keystore.jks:/etc/kafka/secrets/kafka.server.keystore.jks:ro,z
- ./ssl/kafka.server.truststore.jks:/etc/kafka/secrets/kafka.server.truststore.jks:ro,z

ready:
image: busybox:1.31-musl
command: tail -f /dev/null
kafka_setup:
image: confluentinc/cp-kafka:5.5.1
depends_on:
kafka-1:
condition: service_healthy
kafka-2:
condition: service_healthy
kafka-3:
condition: service_healthy
condition: service_healthy
command: "bash -c 'kafka-topics --zookeeper zookeeper:32181 --create --if-not-exists --partitions 4 --replication-factor 2 --topic consumer_group_implementation_test && \
kafka-topics --zookeeper zookeeper:32181 --create --if-not-exists --partitions 4 --replication-factor 2 --topic test0p8p0 && \
kafka-topics --zookeeper zookeeper:32181 --list'"
80 changes: 47 additions & 33 deletions test/integration/kayrock/compatibility_0_p_10_and_later_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -65,40 +65,54 @@ defmodule KafkaEx.KayrockCompatibility0p10AndLaterTest do
# note this checks against the version of broker we're running in test
# api_key, max_version, min_version
api_versions_kafka_0_11_0_1 = [
[0, 3, 0],
[1, 5, 0],
[2, 2, 0],
[3, 4, 0],
[4, 0, 0],
[5, 0, 0],
[6, 3, 0],
[7, 1, 1],
[8, 3, 0],
[9, 3, 0],
[10, 1, 0],
[11, 2, 0],
[12, 1, 0],
[13, 1, 0],
[14, 1, 0],
[15, 1, 0],
[16, 1, 0],
[17, 0, 0],
[18, 1, 0],
[19, 2, 0],
[20, 1, 0],
[21, 0, 0],
[22, 0, 0],
[23, 0, 0],
[24, 0, 0],
[25, 0, 0],
[26, 0, 0],
[0, 8, 0],
[1, 11, 0],
[2, 5, 0],
[3, 9, 0],
[4, 4, 0],
[5, 2, 0],
[6, 6, 0],
[7, 3, 0],
[8, 8, 0],
[9, 7, 0],
[10, 3, 0],
[11, 7, 0],
[12, 4, 0],
[13, 4, 0],
[14, 5, 0],
[15, 5, 0],
[16, 3, 0],
[17, 1, 0],
[18, 3, 0],
[19, 5, 0],
[20, 4, 0],
[21, 1, 0],
[22, 3, 0],
[23, 3, 0],
[24, 1, 0],
[25, 1, 0],
[26, 1, 0],
[27, 0, 0],
[28, 0, 0],
[29, 0, 0],
[30, 0, 0],
[31, 0, 0],
[32, 0, 0],
[33, 0, 0]
[28, 3, 0],
[29, 2, 0],
[30, 2, 0],
[31, 2, 0],
[32, 2, 0],
[33, 1, 0],
[34, 1, 0],
[35, 1, 0],
[36, 2, 0],
[37, 2, 0],
[38, 2, 0],
[39, 2, 0],
[40, 2, 0],
[41, 2, 0],
[42, 2, 0],
[43, 2, 0],
[44, 1, 0],
[45, 0, 0],
[46, 0, 0],
[47, 0, 0]
]

response = KafkaEx.api_versions(worker_name: client)
Expand Down
80 changes: 47 additions & 33 deletions test/integration/server0_p_10_p_1_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,54 @@ defmodule KafkaEx.Server0P10P1.Test do
# note this checks against the version of broker we're running in test
# api_key, max_version, min_version
api_versions_kafka_0_11_0_1 = [
[0, 3, 0],
[1, 5, 0],
[2, 2, 0],
[3, 4, 0],
[4, 0, 0],
[5, 0, 0],
[6, 3, 0],
[7, 1, 1],
[8, 3, 0],
[9, 3, 0],
[10, 1, 0],
[11, 2, 0],
[12, 1, 0],
[13, 1, 0],
[14, 1, 0],
[15, 1, 0],
[16, 1, 0],
[17, 0, 0],
[18, 1, 0],
[19, 2, 0],
[20, 1, 0],
[21, 0, 0],
[22, 0, 0],
[23, 0, 0],
[24, 0, 0],
[25, 0, 0],
[26, 0, 0],
[0, 8, 0],
[1, 11, 0],
[2, 5, 0],
[3, 9, 0],
[4, 4, 0],
[5, 2, 0],
[6, 6, 0],
[7, 3, 0],
[8, 8, 0],
[9, 7, 0],
[10, 3, 0],
[11, 7, 0],
[12, 4, 0],
[13, 4, 0],
[14, 5, 0],
[15, 5, 0],
[16, 3, 0],
[17, 1, 0],
[18, 3, 0],
[19, 5, 0],
[20, 4, 0],
[21, 1, 0],
[22, 3, 0],
[23, 3, 0],
[24, 1, 0],
[25, 1, 0],
[26, 1, 0],
[27, 0, 0],
[28, 0, 0],
[29, 0, 0],
[30, 0, 0],
[31, 0, 0],
[32, 0, 0],
[33, 0, 0]
[28, 3, 0],
[29, 2, 0],
[30, 2, 0],
[31, 2, 0],
[32, 2, 0],
[33, 1, 0],
[34, 1, 0],
[35, 1, 0],
[36, 2, 0],
[37, 2, 0],
[38, 2, 0],
[39, 2, 0],
[40, 2, 0],
[41, 2, 0],
[42, 2, 0],
[43, 2, 0],
[44, 1, 0],
[45, 0, 0],
[46, 0, 0],
[47, 0, 0]
]

response = KafkaEx.api_versions()
Expand Down
Loading

0 comments on commit 788813b

Please sign in to comment.