buttonmen-dev / buttonmen

Buttonmen - an online dice game
Other
16 stars 23 forks source link

replay testing regression #2233

Open cgolubi1 opened 7 years ago

cgolubi1 commented 7 years ago

Replay testing on two different branches i've tried recently has failed with:

$ ./replay_loop 
mysqlshow: Unknown database 'buttonmen'
Creating buttonmen
Populating buttonmen
buttonmen_test already exists - recreating it
Creating buttonmen_test
Populating buttonmen_test
Starting game 1
Traceback (most recent call last):
  File "./test_log_games", line 71, in <module>
    c.log_test_game(i, button1, button2)
  File "lib/random_ai.py", line 1520, in log_test_game
    self.next_game_action()
  File "lib/random_ai.py", line 1511, in next_game_action
    self.bug("LoggingBMClient.next_game_action() has no action for state %s" % state) 
  File "lib/random_ai.py", line 1419, in bug
    raise ValueError, message
ValueError: LoggingBMClient.next_game_action() has no action for state START_GAME
cgolubi1 commented 7 years ago

I'm sure this was caused by the third-party game creation merge. I'll figure it out and submit a fix (assuming the issue is client-side).

blackshadowshade commented 7 years ago

It's just occurred to me what this problem is.

In #2087, you'll note that the test class BMInterfaceTestAbstract required a new testing function create_game_self_first() to implicitly specify the creator ID to be the first player ID. My bet is that you'll need something similar in the replay logic to explicitly default the game creator ID to being the first player ID.

cgolubi1 commented 6 years ago

Hmm, i believe you, but that seems weird, because no corresponding change was needed in responderTest.php afaict... And replay testing should be using verify_api_createGame() just like responderTest. Am i just missing how what responderTest is doing changed?

cgolubi1 commented 6 years ago

Okay, figured it out: random_ai.py is calling bmapi.create_game() as if it takes positional args, but it takes keyword args. My fault; fix coming.

cgolubi1 commented 6 years ago

Okay, there must be some weird third-party-game-creation behavior hidden here as well, though. I think if you create a game specifying a player who doesn't exist (or a button that doesn't exist?), you wind up in this START_GAME state, where that should be an error. I'm out of time for today, but we should demonstrate and fix that behavior.