Skip to content

Commit c2c8b6b

Browse files
authored
integration tests upgrade (confluentinc#1401)
* fix .env with newer docker-compose * fix basic auth integration test * protoc test fix with newer Python and protobuf versions
1 parent 5749122 commit c2c8b6b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+454
-4359
lines changed

tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The easiest way to arrange for this is:
6060

6161
And also:
6262

63-
source ./tests/docker/.env
63+
source ./tests/docker/.env.sh
6464

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

File renamed without changes.

tests/docker/bin/certify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eu
55
PY_DOCKER_BIN="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
66
export PASS="abcdefgh"
77

8-
source ${PY_DOCKER_BIN}/../.env
8+
source ${PY_DOCKER_BIN}/../.env.sh
99

1010
mkdir -p ${TLS}
1111

tests/docker/bin/cluster_down.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -eu
44

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

88
echo "Destroying cluster.."
99
docker-compose -f $PY_DOCKER_COMPOSE_FILE down -v --remove-orphans

tests/docker/bin/cluster_up.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -eu
44

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

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

3030
echo "Configuring Environment..."
31-
source ${PY_DOCKER_SOURCE}/.env
31+
source ${PY_DOCKER_SOURCE}/.env.sh
3232

3333
echo "Generating SSL certs..."
3434
${PY_DOCKER_BIN}/certify.sh

tests/docker/docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ services:
5252
volumes:
5353
- ./conf:/conf
5454
environment:
55-
SCHEMA_REGISTRY_HOST_NAME: schema-registry2
55+
SCHEMA_REGISTRY_HOST_NAME: schema-registry-basic-auth
5656
SCHEMA_REGISTRY_KAFKASTORE_TOPIC: _schemas2
57-
SCHEMA_REGISTRY_SCHEMA_REGISTRY_ZK_NAMESPACE: schema_registry2
57+
SCHEMA_REGISTRY_SCHEMA_REGISTRY_GROUP_ID: schema-registry-basic-auth
5858
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9092
5959
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8083, https://0.0.0.0:8084
6060
SCHEMA_REGISTRY_INTER_INSTANCE_PROTOCOL: https

tests/integration/integration_test.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import json
2929
import gc
3030
import struct
31+
import re
3132

3233
try:
3334
# Memory tracker
@@ -795,13 +796,17 @@ def verify_avro_basic_auth(mode_conf):
795796
if mode_conf is None:
796797
abort_on_missing_configuration('avro-basic-auth')
797798

798-
url = {
799-
'schema.registry.basic.auth.credentials.source': 'URL'
799+
url = mode_conf.get('schema.registry.url')
800+
credentials = mode_conf.get('schema.registry.basic.auth.user.info')
801+
802+
url_conf = {
803+
'schema.registry.basic.auth.credentials.source': 'URL',
804+
'schema.registry.url': str(re.sub("(^https?://)", f"\\1{credentials}@", url))
800805
}
801806

802807
user_info = {
803808
'schema.registry.basic.auth.credentials.source': 'USER_INFO',
804-
'schema.registry.basic.auth.user.info': mode_conf.get('schema.registry.basic.auth.user.info')
809+
'schema.registry.basic.auth.user.info': credentials
805810
}
806811

807812
sasl_inherit = {
@@ -813,7 +818,7 @@ def verify_avro_basic_auth(mode_conf):
813818
base_conf = {
814819
'bootstrap.servers': bootstrap_servers,
815820
'error_cb': error_cb,
816-
'schema.registry.url': schema_registry_url
821+
'schema.registry.url': url
817822
}
818823

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

831836
print('-' * 10, 'Verifying basic auth source URL', '-' * 10)
832-
run_avro_loop(dict(base_conf, **url), dict(consumer_conf, **url))
837+
run_avro_loop(dict(base_conf, **url_conf), dict(consumer_conf, **url_conf))
833838

834839

835840
def run_avro_loop(producer_conf, consumer_conf):

tests/integration/schema_registry/data/PublicTestProto.proto

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/integration/schema_registry/data/DependencyTestProto.proto renamed to tests/integration/schema_registry/data/proto/DependencyTestProto.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
syntax = "proto3";
22

3-
import "NestedTestProto.proto";
4-
import "PublicTestProto.proto";
3+
import "tests/integration/schema_registry/data/proto/NestedTestProto.proto";
4+
import "tests/integration/schema_registry/data/proto/PublicTestProto.proto";
55

66
package tests.integration.serialization.data;
77

tests/integration/schema_registry/data/proto/DependencyTestProto_pb2.py

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
WORK_DIR:=$(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
22
PROTO_HOME=/usr/local/opt/include
3-
SRC_DIR=$(WORK_DIR)
4-
TARGET_DIR=$(WORK_DIR)/../gen
3+
SRC_DIR=$(realpath $(WORK_DIR)/../../../../..)
54

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

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

1514
clean:
16-
rm -f $(TARGET_DIR)/*_pb2.py
15+
rm -f *_pb2.py

tests/integration/schema_registry/data/proto/NestedTestProto_pb2.py

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
syntax = "proto3";
2+
3+
import public "tests/integration/schema_registry/data/proto/TestProto.proto";
4+
5+
package tests.integration.serialization.data;
6+

tests/integration/schema_registry/data/proto/PublicTestProto_pb2.py

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/schema_registry/data/proto/SInt32Value_pb2.py

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/schema_registry/data/proto/SInt64Value_pb2.py

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/schema_registry/data/proto/TestProto_pb2.py

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/schema_registry/data/common_proto.proto renamed to tests/integration/schema_registry/data/proto/common_proto.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ syntax = "proto3";
33
package Criteo.Glup;
44
option java_package = "com.criteo.glup";
55

6-
import "metadata_proto.proto";
6+
import "tests/integration/schema_registry/data/proto/metadata_proto.proto";
77

88
/* Describes if an event or campaign is an appinstall or normal
99
* retargeting one

tests/integration/schema_registry/data/proto/common_proto_pb2.py

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)