Skip to content

Commit

Permalink
integration tests upgrade (#1401)
Browse files Browse the repository at this point in the history
* fix .env with newer docker-compose
* fix basic auth integration test
* protoc test fix with newer Python and protobuf versions
  • Loading branch information
emasab committed Jul 27, 2022
1 parent 5749122 commit c2c8b6b
Show file tree
Hide file tree
Showing 43 changed files with 454 additions and 4,359 deletions.
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The easiest way to arrange for this is:

And also:

source ./tests/docker/.env
source ./tests/docker/.env.sh

which sets environment variables referenced by `./tests/integration/testconf.json`.

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/docker/bin/certify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
PY_DOCKER_BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
export PASS="abcdefgh"

source ${PY_DOCKER_BIN}/../.env
source ${PY_DOCKER_BIN}/../.env.sh

mkdir -p ${TLS}

Expand Down
2 changes: 1 addition & 1 deletion tests/docker/bin/cluster_down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eu

PY_DOCKER_BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source ${PY_DOCKER_BIN}/../.env
source ${PY_DOCKER_BIN}/../.env.sh

echo "Destroying cluster.."
docker-compose -f $PY_DOCKER_COMPOSE_FILE down -v --remove-orphans
4 changes: 2 additions & 2 deletions tests/docker/bin/cluster_up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eu

PY_DOCKER_BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
source ${PY_DOCKER_BIN}/../.env
source ${PY_DOCKER_BIN}/../.env.sh

# Wait for http service listener to come up and start serving
# $1 http service name
Expand All @@ -28,7 +28,7 @@ await_http() {
}

echo "Configuring Environment..."
source ${PY_DOCKER_SOURCE}/.env
source ${PY_DOCKER_SOURCE}/.env.sh

echo "Generating SSL certs..."
${PY_DOCKER_BIN}/certify.sh
Expand Down
4 changes: 2 additions & 2 deletions tests/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ services:
volumes:
- ./conf:/conf
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry2
SCHEMA_REGISTRY_HOST_NAME: schema-registry-basic-auth
SCHEMA_REGISTRY_KAFKASTORE_TOPIC: _schemas2
SCHEMA_REGISTRY_SCHEMA_REGISTRY_ZK_NAMESPACE: schema_registry2
SCHEMA_REGISTRY_SCHEMA_REGISTRY_GROUP_ID: schema-registry-basic-auth
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9092
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8083, https://0.0.0.0:8084
SCHEMA_REGISTRY_INTER_INSTANCE_PROTOCOL: https
Expand Down
15 changes: 10 additions & 5 deletions tests/integration/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import json
import gc
import struct
import re

try:
# Memory tracker
Expand Down Expand Up @@ -795,13 +796,17 @@ def verify_avro_basic_auth(mode_conf):
if mode_conf is None:
abort_on_missing_configuration('avro-basic-auth')

url = {
'schema.registry.basic.auth.credentials.source': 'URL'
url = mode_conf.get('schema.registry.url')
credentials = mode_conf.get('schema.registry.basic.auth.user.info')

url_conf = {
'schema.registry.basic.auth.credentials.source': 'URL',
'schema.registry.url': str(re.sub("(^https?://)", f"\\1{credentials}@", url))
}

user_info = {
'schema.registry.basic.auth.credentials.source': 'USER_INFO',
'schema.registry.basic.auth.user.info': mode_conf.get('schema.registry.basic.auth.user.info')
'schema.registry.basic.auth.user.info': credentials
}

sasl_inherit = {
Expand All @@ -813,7 +818,7 @@ def verify_avro_basic_auth(mode_conf):
base_conf = {
'bootstrap.servers': bootstrap_servers,
'error_cb': error_cb,
'schema.registry.url': schema_registry_url
'schema.registry.url': url
}

consumer_conf = dict({'group.id': generate_group_id(),
Expand All @@ -829,7 +834,7 @@ def verify_avro_basic_auth(mode_conf):
run_avro_loop(dict(base_conf, **sasl_inherit), dict(consumer_conf, **sasl_inherit))

print('-' * 10, 'Verifying basic auth source URL', '-' * 10)
run_avro_loop(dict(base_conf, **url), dict(consumer_conf, **url))
run_avro_loop(dict(base_conf, **url_conf), dict(consumer_conf, **url_conf))


def run_avro_loop(producer_conf, consumer_conf):
Expand Down
6 changes: 0 additions & 6 deletions tests/integration/schema_registry/data/PublicTestProto.proto

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";

import "NestedTestProto.proto";
import "PublicTestProto.proto";
import "tests/integration/schema_registry/data/proto/NestedTestProto.proto";
import "tests/integration/schema_registry/data/proto/PublicTestProto.proto";

package tests.integration.serialization.data;

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
WORK_DIR:=$(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
PROTO_HOME=/usr/local/opt/include
SRC_DIR=$(WORK_DIR)
TARGET_DIR=$(WORK_DIR)/../gen
SRC_DIR=$(realpath $(WORK_DIR)/../../../../..)

PROTOS := common_proto.proto DependencyTestProto.proto exampleProtoCriteo.proto $\
metadata_proto.proto NestedTestProto.proto PublicTestProto.proto $\
SInt32Value.proto SInt64Value.proto TestProto.proto

compile: $(PROTOS)
for proto in $(PROTOS); do \
protoc -I=$(PROTO_HOME) -I=$(SRC_DIR) --python_out=$(TARGET_DIR) $$proto ; \
(cd $(SRC_DIR) && protoc -I=$(PROTO_HOME) -I=$(SRC_DIR) --python_out=$(SRC_DIR) tests/integration/schema_registry/data/proto/$$proto ;) \
done

clean:
rm -f $(TARGET_DIR)/*_pb2.py
rm -f *_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
syntax = "proto3";

import public "tests/integration/schema_registry/data/proto/TestProto.proto";

package tests.integration.serialization.data;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions tests/integration/schema_registry/data/proto/SInt32Value_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions tests/integration/schema_registry/data/proto/SInt64Value_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions tests/integration/schema_registry/data/proto/TestProto_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ syntax = "proto3";
package Criteo.Glup;
option java_package = "com.criteo.glup";

import "metadata_proto.proto";
import "tests/integration/schema_registry/data/proto/metadata_proto.proto";

/* Describes if an event or campaign is an appinstall or normal
* retargeting one
Expand Down
37 changes: 37 additions & 0 deletions tests/integration/schema_registry/data/proto/common_proto_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c2c8b6b

Please sign in to comment.