Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d862a45
New script for running backend locally
pcapriotti Feb 2, 2023
8b5ff16
Add nginz to script
pcapriotti Feb 3, 2023
ff17515
Check prerequisites
pcapriotti Feb 3, 2023
74c9484
Wait for check_status
pcapriotti Feb 3, 2023
c4f3686
Start services synchronously
pcapriotti Feb 3, 2023
8ee4262
Send SIGTERM again if processes don't terminate
pcapriotti Feb 3, 2023
270136e
Small refactoring
pcapriotti Feb 3, 2023
41646c1
Support multiple instances of the same service
pcapriotti Feb 3, 2023
61d1f50
Better handling of spawn failures
pcapriotti Feb 6, 2023
f01f406
Start nginx by copying the whole conf directory
pcapriotti Feb 6, 2023
1eee317
Configure nginx's pid
pcapriotti Feb 6, 2023
4685449
Add domains to logs and nginx upstreams
pcapriotti Feb 6, 2023
b508395
Avoid adding Host header twice to fed requests
pcapriotti Feb 7, 2023
67e0ffe
Add DNS entries for local nginx instances
pcapriotti Feb 7, 2023
d52746b
Set log level to Warn on all services
pcapriotti Feb 7, 2023
ca62d72
Fix cannon port in integration configuration
pcapriotti Feb 7, 2023
aaddba7
Set log level dynamically for all services
pcapriotti Feb 7, 2023
e2d494d
Pass environment through to the main script
pcapriotti Feb 7, 2023
13d29ec
Add service spawn timeout
pcapriotti Feb 7, 2023
044e94b
Add a second cannon instance
pcapriotti Feb 7, 2023
80449a6
Honour INTEGRATION_FEDERATION_TESTS variable
pcapriotti Feb 7, 2023
220e368
Remove old integration.sh script
pcapriotti Feb 7, 2023
0b1c704
Add CHANGELOG entry
pcapriotti Feb 7, 2023
a772785
Leftovers
pcapriotti Feb 8, 2023
7f493e9
Add pyyaml to nix
pcapriotti Feb 8, 2023
362d103
Replace timeout thread with a simple time check
pcapriotti Feb 8, 2023
0d3834d
Move start-service-only logic to run-service
pcapriotti Feb 8, 2023
2149ad6
Merge remote-tracking branch 'origin/develop' into pcapriotti/end2end
pcapriotti Feb 9, 2023
64d8687
Set up different ES indices for the two backends
pcapriotti Feb 9, 2023
a1f1c24
Use alternate index for the second backend
pcapriotti Feb 9, 2023
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
48 changes: 47 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,50 @@ ifeq ($(package), all)
./dist/galley-schema --keyspace galley_test --replication-factor 1 --reset
./dist/gundeck-schema --keyspace gundeck_test --replication-factor 1 --reset
./dist/spar-schema --keyspace spar_test --replication-factor 1 --reset
ifeq ($(INTEGRATION_FEDERATION_TESTS), 1)
./dist/brig-schema --keyspace brig_test2 --replication-factor 1 --reset
./dist/galley-schema --keyspace galley_test2 --replication-factor 1 --reset
./dist/gundeck-schema --keyspace gundeck_test2 --replication-factor 1 --reset
./dist/spar-schema --keyspace spar_test2 --replication-factor 1 --reset
endif
else
$(EXE_SCHEMA) --keyspace $(package)_test --replication-factor 1 --reset
ifeq ($(INTEGRATION_FEDERATION_TESTS), 1)
$(EXE_SCHEMA) --keyspace $(package)_test2 --replication-factor 1 --reset
endif
endif
./dist/brig-index reset --elasticsearch-server http://localhost:9200 > /dev/null

# Usage:
#
# Migrate all keyspaces and reset the ES index
# make db-migrate
#
# Migrate keyspace for only one service, say galley:
# make db-migrate package=galley
.PHONY: db-reset
db-reset: c
@echo "Make sure you have ./deploy/dockerephemeral/run.sh running in another window!"
ifeq ($(package), all)
./dist/brig-schema --keyspace brig_test --replication-factor 1 --reset
./dist/galley-schema --keyspace galley_test --replication-factor 1 --reset
./dist/gundeck-schema --keyspace gundeck_test --replication-factor 1 --reset
./dist/spar-schema --keyspace spar_test --replication-factor 1 --reset
ifeq ($(INTEGRATION_FEDERATION_TESTS), 1)
./dist/brig-schema --keyspace brig_test2 --replication-factor 1 --reset
./dist/galley-schema --keyspace galley_test2 --replication-factor 1 --reset
./dist/gundeck-schema --keyspace gundeck_test2 --replication-factor 1 --reset
./dist/spar-schema --keyspace spar_test2 --replication-factor 1 --reset
endif
else
$(EXE_SCHEMA) --keyspace $(package)_test --replication-factor 1 --reset
ifeq ($(INTEGRATION_FEDERATION_TESTS), 1)
$(EXE_SCHEMA) --keyspace $(package)_test2 --replication-factor 1 --reset
endif
endif
./dist/brig-index reset --elasticsearch-index directory_test --elasticsearch-server http://localhost:9200 > /dev/null
./dist/brig-index reset --elasticsearch-index directory_test2 --elasticsearch-server http://localhost:9200 > /dev/null

# Usage:
#
# Migrate all keyspaces and reset the ES index
Expand All @@ -267,7 +306,14 @@ db-migrate: c
./dist/galley-schema --keyspace galley_test --replication-factor 1 > /dev/null
./dist/gundeck-schema --keyspace gundeck_test --replication-factor 1 > /dev/null
./dist/spar-schema --keyspace spar_test --replication-factor 1 > /dev/null
./dist/brig-index reset --elasticsearch-server http://localhost:9200 > /dev/null
ifeq ($(INTEGRATION_FEDERATION_TESTS), 1)
./dist/brig-schema --keyspace brig_test2 --replication-factor 1 > /dev/null
./dist/galley-schema --keyspace galley_test2 --replication-factor 1 > /dev/null
./dist/gundeck-schema --keyspace gundeck_test2 --replication-factor 1 > /dev/null
./dist/spar-schema --keyspace spar_test2 --replication-factor 1 > /dev/null
endif
./dist/brig-index reset --elasticsearch-index-prefix directory --elasticsearch-server http://localhost:9200 > /dev/null
./dist/brig-index reset --elasticsearch-index-prefix directory2 --elasticsearch-server http://localhost:9200 > /dev/null

#################################
## dependencies
Expand Down
1 change: 1 addition & 0 deletions changelog.d/5-internal/local-end2end-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New integration test script with support for running end2end tests locally
2 changes: 1 addition & 1 deletion charts/gundeck/templates/tests/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data:
# some gundeck integration tests make use of two different
# cannon instances to test the distributed case. when running
# the integration tests locally, the two instances will be spun
# up separately (see `wire-server/services/integration.sh`).
# up separately (see `wire-server/services/run-services`).
#
# here, we spin up two replicas, provide the integration tests
# with the same service coordinates, and rely on the k8s load
Expand Down
4 changes: 3 additions & 1 deletion deploy/dockerephemeral/coredns-config/db.example.com
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ $ORIGIN example.com.

www IN A 127.0.0.1
IN AAAA ::1
_wire-server-federator._tcp IN SRV 0 0 443 federator.integration.example.com.
_wire-server-federator._tcp IN SRV 0 0 8443 localhost.
_wire-server-federator._tcp.b IN SRV 0 0 9443 localhost.

2 changes: 1 addition & 1 deletion hack/bin/cabal-run-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ run_integration_tests() {
service_dir="$TOP_LEVEL/services/$package"

cd "$service_dir"
"$TOP_LEVEL/services/integration.sh" \
"$TOP_LEVEL/services/run-services" \
"$TOP_LEVEL/dist/$package-integration" \
-s "$service_dir/$package.integration.yaml" \
-i "$TOP_LEVEL/services/integration.yaml" \
Expand Down
2 changes: 1 addition & 1 deletion nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ self: super: {
inherit (super) stdenv fetchurl;
};

helm = super.callPackage ./pkgs/helm {};
helm = super.callPackage ./pkgs/helm { };

helmfile = staticBinary {
pname = "helmfile";
Expand Down
3 changes: 2 additions & 1 deletion nix/wire-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ in
pkgs.kind
pkgs.netcat
pkgs.niv
pkgs.python3
(pkgs.python3.withPackages
(ps: with ps; [ pyyaml ]))
pkgs.rsync
pkgs.wget
pkgs.yq
Expand Down
2 changes: 0 additions & 2 deletions services/brig/brig.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,4 @@ optSettings:
setEnableMLS: true

logLevel: Warn
# ^ NOTE: We log too much in brig, if we set this to Info like other services, running tests
# produces too many logs, hence this is set to Warn.
logNetStrings: false
13 changes: 12 additions & 1 deletion services/brig/src/Brig/Index/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,18 @@ elasticServerParser =
restrictedElasticSettingsParser :: Parser ElasticSettings
restrictedElasticSettingsParser = do
server <- elasticServerParser
pure $ localElasticSettings & esServer .~ server
prefix <-
strOption
( long "elasticsearch-index-prefix"
<> metavar "PREFIX"
<> help "Elasticsearch Index Prefix. The actual index name will be PREFIX_test."
<> value "directory"
<> showDefault
)
pure $
localElasticSettings
& esServer .~ server
& esIndex .~ ES.IndexName (prefix <> "_test")

indexNameParser :: Parser ES.IndexName
indexNameParser =
Expand Down
2 changes: 1 addition & 1 deletion services/cannon/cannon.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ drainOpts:
millisecondsBetweenBatches: 500
minBatchSize: 5

logLevel: Info
logLevel: Warn
logNetStrings: false
2 changes: 1 addition & 1 deletion services/cargohold/cargohold.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ settings:
downloadLinkTTL: 300 # Seconds
federationDomain: example.com

logLevel: Info
logLevel: Warn
logNetStrings: false
2 changes: 1 addition & 1 deletion services/federator/federator.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ galley:
host: 0.0.0.0
port: 8085

logLevel: Debug
logLevel: Warn
logNetStrings: false

optSettings:
Expand Down
4 changes: 3 additions & 1 deletion services/federator/src/Federator/Remote.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ interpretRemote = interpret $ \case
let path =
LBS.toStrict . toLazyByteString $
HTTP.encodePathSegments ["federation", componentName component, rpc]
req' = HTTP2.requestBuilder HTTP.methodPost path headers body
-- filter out Host header, because the HTTP2 client adds it back
headers' = filter ((/= "Host") . fst) headers
req' = HTTP2.requestBuilder HTTP.methodPost path headers' body
tlsConfig = mkTLSConfig settings hostname port

resp <- mapError (RemoteError target) . (fromEither @FederatorClientHTTP2Error =<<) . embed $
Expand Down
2 changes: 1 addition & 1 deletion services/galley/galley.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ settings:
status: disabled
lockStatus: locked

logLevel: Info
logLevel: Warn
logNetStrings: false

journal: # if set, journals; if not set, disables journaling
Expand Down
2 changes: 1 addition & 1 deletion services/gundeck/gundeck.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ settings:
hard: 30 # more than this number of threads will not be allowed
soft: 10 # more than this number of threads will be warned about

logLevel: Info
logLevel: Warn
logNetStrings: false
171 changes: 0 additions & 171 deletions services/integration.sh

This file was deleted.

2 changes: 1 addition & 1 deletion services/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ backendTwo:
port: 9084
cannon:
host: 127.0.0.1
port: 9086
port: 9083

redis2:
host: 127.0.0.1
Expand Down
19 changes: 19 additions & 0 deletions services/nginz/integration-test/conf/nginz/integration.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# plain TCP/http listening for integration tests only.
listen 8080;
listen 8081;

# for nginx-without-tls, we need to use a separate port for http2 traffic,
# as nginx cannot handle unencrypted http1 and http2 trafic on the same
# port.
# This port is only used for trying out nginx http2 forwarding without TLS locally and should not
# be ported to any production nginz config.
listen 8090 http2;

######## TLS/SSL block start ##############
#
# Most integration tests simply use the http ports 8080 and 8081
# But to also test tls forwarding, this port can be used.
# This applies only locally, as for kubernetes (helm chart) based deployments,
# TLS is terminated at the ingress level, not at nginz level
listen 8443 ssl http2;
listen [::]:8443 ssl http2;
Loading