MCPcopy Create free account
hub / github.com/ddnet/ddnet / smoke_test

Function smoke_test

scripts/integration_test.py:667–792  ·  view source on GitHub ↗
(test_env)

Source from the content-addressed store, hash-verified

665
666@test
667def smoke_test(test_env):
668 client1 = test_env.client(["logfile client1.log", "player_name client1", "cl_save_settings 1"])
669 server = test_env.server(["logfile server.log", "sv_demo_chat 1", "sv_map coverage", "sv_tee_historian 1"])
670 wait_for_startup([client1, server])
671 # Start client2 after client1 to avoid fetching resources twice.
672 # Wait for both clients to start to avoid flaky behavior due time required for the client to launch.
673 client2 = test_env.client(["logfile client2.log", "player_name client2"])
674 wait_for_startup([client2])
675
676 server.command("record server")
677 client1.command("debug 1")
678 client1.command("stdout_output_level 2; loglevel 2")
679 client1.command(f"connect localhost:{server.port}")
680 server.wait_for_log_prefix("server: player has entered the game", timeout=10)
681 client1.wait_for_log_exact("client: state change. last=2 current=3", timeout=15)
682 client1.command("stdout_output_level 0; loglevel 0")
683 client1.command("debug 0")
684 client1.command("record client1")
685
686 client2.command(f"connect localhost:{server.port}")
687 server.wait_for_log_prefix("server: player has entered the game", timeout=10)
688 for _ in range(5):
689 server.wait_for_log(
690 lambda l: l.line.startswith("chat: *** client1 finished in:") or l.line.startswith("chat: *** client2 finished in:"),
691 description="log lines with client1 and client2 finishes",
692 timeout=40,
693 )
694
695 client1.command("say hello world")
696 server.wait_for_log_exact("chat: 0:-2:client1: hello world")
697
698 client1.command(f"rcon_auth {server.rcon_password}")
699 server.wait_for_log_exact("server: ClientId=0 authed with key='default_admin' (admin)")
700
701 client1.command(
702 'say "/mc; {}"'.format(
703 "; ".join(
704 l.strip()
705 for l in """
706 top5
707 rank
708 team 512
709 emote happy -999
710 pause
711 points
712 mapinfo
713 list
714 whisper client2 hi
715 kill
716 settings cheats
717 timeout 123
718 timer broadcast
719 cmdlist
720 saytime
721 """.strip().split("\n")
722 )
723 )
724 )

Callers

nothing calls this directly

Calls 10

wait_for_startupFunction · 0.85
clientMethod · 0.80
serverMethod · 0.80
wait_for_log_prefixMethod · 0.80
wait_for_log_exactMethod · 0.80
wait_for_logMethod · 0.80
clear_eventsMethod · 0.80
wait_for_exitMethod · 0.80
commandMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected