-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from aiven/aiven-anton/chore/smoke-test-docke…
…r-image chore: Add very basic container smoke tests
- Loading branch information
Showing
9 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Smoke test Docker image | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
smoke-test-container: | ||
runs-on: ubuntu-latest | ||
env: | ||
BUILDKIT_PROGRESS: plain | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build and start services | ||
run: docker compose --file=container/compose.yml up --build --wait --detach | ||
|
||
- name: Smoke test registry | ||
run: | | ||
response=$( | ||
curl --silent --verbose --fail --request POST \ | ||
--header 'Content-Type: application/vnd.schemaregistry.v1+json' \ | ||
--data '{"schema": "{\"type\": \"record\", \"name\": \"Obj\", \"fields\":[{\"name\": \"age\", \"type\": \"int\"}]}"}' \ | ||
http://localhost:8081/subjects/test-key/versions | ||
) | ||
echo "$response" | ||
[[ $response == '{"id":1}' ]] || exit 1 | ||
echo "Ok!" | ||
- name: Smoke test REST proxy | ||
run: | | ||
response=$(curl --silent --verbose --fail http://localhost:8082/topics) | ||
echo "$response" | ||
[[ $response == '["_schemas","__consumer_offsets"]' ]] || exit 1 | ||
echo "Ok!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Copyright (c) 2023 Aiven Ltd | ||
See LICENSE for details | ||
""" | ||
from __future__ import annotations | ||
|
||
from http import HTTPStatus | ||
from typing import Final | ||
|
||
import aiohttp | ||
import asyncio | ||
import sys | ||
|
||
timeout: Final = aiohttp.ClientTimeout(total=2) | ||
|
||
|
||
async def check_ok(url: str) -> bool: | ||
async with aiohttp.ClientSession() as session: | ||
response = await session.get(url) | ||
if response.status != HTTPStatus.OK: | ||
print( | ||
f"Server responded with non-OK {response.status=} {url=}", | ||
file=sys.stderr, | ||
) | ||
raise SystemExit(1) | ||
print("Ok!", file=sys.stderr) | ||
|
||
|
||
def main() -> None: | ||
url = sys.argv[1] | ||
print(f"Checking {url=}", file=sys.stderr) | ||
asyncio.run(check_ok(url)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters