Skip to content

Commit

Permalink
feat: add logs when we expect or wait for the user to do something
Browse files Browse the repository at this point in the history
If the user fails to perform it, they wouldn't know what we were expecting. This way our expectations are clear.
  • Loading branch information
ryan-gang committed May 10, 2024
1 parent 61229ad commit 9414dbe
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 166 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func (t ReceiveReplicationHandshakeTestCase) RunAll(client *resp_connection.Resp
}

func (t ReceiveReplicationHandshakeTestCase) RunPingStep(client *resp_connection.RespConnection, logger *logger.Logger) error {
logger.Debugf("Waiting for replica to initiate Replication handshake.")
logger.Debugf("Waiting for replica to send %q command", "PING")

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

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

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

func (t ReceiveReplicationHandshakeTestCase) RunReplconfStep2(client *resp_connection.RespConnection, logger *logger.Logger) error {
logger.Debugf("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 +114,8 @@ func (t ReceiveReplicationHandshakeTestCase) RunReplconfStep2(client *resp_conne
}

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

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

0 comments on commit 9414dbe

Please sign in to comment.