Run PostgreSQL and Cassandra integration tests and deploy Compose stack
Docker test deployment / test-build-deploy (push) Failing after 8m35s
Docker test deployment / test-build-deploy (push) Failing after 8m35s
This commit is contained in:
+20
-2
@@ -4,6 +4,7 @@ import argparse
|
||||
import http.cookiejar
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
@@ -12,7 +13,7 @@ from uuid import uuid4
|
||||
from dotenv import dotenv_values
|
||||
|
||||
|
||||
def check(base_url: str, service_token: str):
|
||||
def check(base_url: str, service_token: str, require_projection=False):
|
||||
jar = http.cookiejar.CookieJar()
|
||||
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(jar))
|
||||
|
||||
@@ -78,6 +79,20 @@ def check(base_url: str, service_token: str):
|
||||
assert history["items"][0]["id"] == event["event_id"]
|
||||
graph = api("/v1/identity/" + linked["master_id"] + "/graph", trusted=True)
|
||||
assert len(graph["identifiers"]) == 1
|
||||
if require_projection:
|
||||
storage = api("/v1/identity/storage", trusted=True)
|
||||
assert storage["graph_backend"] == "postgresql"
|
||||
assert storage["canonical_profile_format"] == "jsonb"
|
||||
assert storage["profile_backend"] == "cassandra"
|
||||
for _ in range(60):
|
||||
profile = api("/v1/users/" + linked["master_id"], trusted=True)
|
||||
if profile["projection_status"] == "current":
|
||||
break
|
||||
time.sleep(1)
|
||||
assert profile["projection_status"] == "current", (
|
||||
"Worker projection not current"
|
||||
)
|
||||
assert profile["attributes"]["smoke"] is True
|
||||
print(
|
||||
"HTTP smoke passed: routes, anonymous cookie, events"
|
||||
+ (", auth, stitching, profile and history" if service_token else "")
|
||||
@@ -92,6 +107,7 @@ def main():
|
||||
action="store_true",
|
||||
help="Do not read or send the service token",
|
||||
)
|
||||
parser.add_argument("--require-projection", action="store_true")
|
||||
args = parser.parse_args()
|
||||
token = ""
|
||||
if not args.public_only:
|
||||
@@ -103,7 +119,9 @@ def main():
|
||||
raise SystemExit(
|
||||
"Configure SERVICE_TOKEN or mount the deployment config volume"
|
||||
)
|
||||
check(args.base_url, token)
|
||||
if args.require_projection and args.public_only:
|
||||
parser.error("Projection checks require a service token")
|
||||
check(args.base_url, token, args.require_projection)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user