Skip to content

Commit

Permalink
Merge pull request #143 from codecrafters-io/CC-1182
Browse files Browse the repository at this point in the history
CC-1182: add logs when we expect or wait for the user to do something
  • Loading branch information
ryan-gang committed May 10, 2024
2 parents 61229ad + 1bdb7e1 commit cb7828d
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ func (t ReceiveReplicationHandshakeTestCase) RunAll(client *resp_connection.Resp
}

func (t ReceiveReplicationHandshakeTestCase) RunPingStep(client *resp_connection.RespConnection, logger *logger.Logger) error {
logger.Infof("master: Waiting for replica to initiate handshake with %q command", "PING")

commandTest := ReceiveCommandTestCase{
Assertion: resp_assertions.NewCommandAssertion("PING"),
Response: resp_value.NewSimpleStringValue("PONG"),
Expand All @@ -53,6 +55,8 @@ func (t ReceiveReplicationHandshakeTestCase) RunPingStep(client *resp_connection
}

func (t ReceiveReplicationHandshakeTestCase) RunReplconfStep1(client *resp_connection.RespConnection, logger *logger.Logger) error {
logger.Infof("master: Waiting for replica to send %q command", "REPLCONF listening-port 6380")

commandTest := ReceiveCommandTestCase{
Assertion: resp_assertions.NewCommandAssertion("REPLCONF", "listening-port", "6380"),
Response: resp_value.NewSimpleStringValue("OK"),
Expand All @@ -63,6 +67,8 @@ func (t ReceiveReplicationHandshakeTestCase) RunReplconfStep1(client *resp_conne
}

func (t ReceiveReplicationHandshakeTestCase) RunReplconfStep2(client *resp_connection.RespConnection, logger *logger.Logger) error {
logger.Infof("master: Waiting for replica to send %q command", "REPLCONF capa")

commandTest := ReceiveCommandTestCase{
Assertion: resp_assertions.NewOnlyCommandAssertion("REPLCONF"),
Response: resp_value.NewSimpleStringValue("OK"),
Expand Down Expand Up @@ -107,6 +113,8 @@ func (t ReceiveReplicationHandshakeTestCase) RunReplconfStep2(client *resp_conne
}

func (t ReceiveReplicationHandshakeTestCase) RunPsyncStep(client *resp_connection.RespConnection, logger *logger.Logger) error {
logger.Infof("master: Waiting for replica to send %q command", "PSYNC")

id := "75cd7bc10c49047e0d163660f3b90625b1af31dc"
commandTest := ReceiveCommandTestCase{
Assertion: resp_assertions.NewCommandAssertion("PSYNC", "?", "-1"),
Expand Down
Loading

0 comments on commit cb7828d

Please sign in to comment.