Skip to content

Commit

Permalink
fix(hyperborea-legends): update checker, add some meme
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexMoshkov committed Nov 3, 2023
1 parent dde3b17 commit 1e14cb3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
14 changes: 8 additions & 6 deletions checkers/hyperborea-legends/hyperborea-legends.checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import utils
from grpc_client import Client
from transliterate import translit
from data_generator import DataGenerator

PORT = 42424
Expand Down Expand Up @@ -77,7 +78,7 @@ async def check_service(request: CheckRequest) -> Verdict:
print(f'>>Total ancestors: {count + 1}')

print(">>Wait service redis cache")
await asyncio.sleep(11)
await asyncio.sleep(15)

print(">>Checking ancestors count get...")
resp = client.get_ancestors_count(token=token)
Expand Down Expand Up @@ -111,9 +112,9 @@ def get(request: GetRequest) -> Verdict:
if resp.burial_place == flag:
print(f'>>Successfully got flag "{flag}"')
return Verdict.OK()
print("Ancestor burial place doesn't contains a correct flag")
print(f'expected: "{flag}" but got "{resp.burial_place}')
return Verdict.CORRUPT('Flag is missing!')
print(">>Ancestor burial place doesn't contains a correct flag")
print(f'>>expected: "{flag}" but got "{resp.burial_place}')
return Verdict.CORRUPT('Flag is corrupted!')
except utils.VerdictException as e:
print(e)
return e.verdict
Expand All @@ -128,12 +129,12 @@ def put(request: PutRequest) -> Verdict:

try:
with Client(host=request.hostname, port=PORT) as client:
print(f'Register and login user: {user.username}')
print(f'>>Register and login user: {user.username}')
client.register_user(username=user.username, password=user.password, species_type='GreatRuss')
token = client.login_user(username=user.username, password=user.password).access_token
flag_id = token

print(f'Create ancestor: {ancestor.name}')
print(f">>Create ancestor: {translit(ancestor.name, language_code='ru', reversed=True)}")
resp = client.create_ancestor(
id=ancestor.id,
name=ancestor.name,
Expand All @@ -143,6 +144,7 @@ def put(request: PutRequest) -> Verdict:
token=token,
)

print(f'>>Successfully put flag "{flag}"')
public_flag_id = base64.b64encode(resp.id).decode()
return Verdict.OK_WITH_FLAG_ID(public_flag_id, flag_id)
except utils.VerdictException as e:
Expand Down
4 changes: 4 additions & 0 deletions services/hyperborea-legends/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ services:
depends_on:
- postgres
- redis
logging:
options:
max-file: "2"
max-size: "5m"
mem_limit: 1G
memswap_limit: 1G
pids_limit: 512
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1e14cb3

Please sign in to comment.