Skip to content

Commit

Permalink
refactor: update fetch request parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-gang committed Sep 25, 2024
1 parent 7fae46d commit e7d11c9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/stagef4.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import (
"github.com/codecrafters-io/kafka-tester/internal/kafka_executable"
"github.com/codecrafters-io/kafka-tester/protocol"
kafkaapi "github.com/codecrafters-io/kafka-tester/protocol/api"
"github.com/codecrafters-io/kafka-tester/protocol/common"
"github.com/codecrafters-io/kafka-tester/protocol/serializer"
"github.com/codecrafters-io/tester-utils/test_case_harness"
)

// ToDo: Reset this file to the placeholder
// Adding this to test how messing with the logs.dir messes with the FETCH request
func testFetch(stageHarness *test_case_harness.TestCaseHarness) error {
b := kafka_executable.NewKafkaExecutable(stageHarness)
if err := b.Run(); err != nil {
return err
}
serializer.GenerateLogDirs()

logger := stageHarness.Logger

Expand Down Expand Up @@ -44,7 +45,7 @@ func testFetch(stageHarness *test_case_harness.TestCaseHarness) error {
FetchSessionEpoch: 0,
Topics: []kafkaapi.Topic{
{
TopicUUID: "bfd99e5e-3235-4552-81f8-d4af1741970c",
TopicUUID: common.TOPIC1_UUID,
Partitions: []kafkaapi.Partition{
{
ID: 0,
Expand Down Expand Up @@ -88,7 +89,7 @@ func testFetch(stageHarness *test_case_harness.TestCaseHarness) error {
logger.Successf("✓ Error code: 0 (NO_ERROR)")

msgValues := []string{}
expectedMsgValues := []string{"Hello World!"}
expectedMsgValues := []string{common.MESSAGE1}
for _, topicResponse := range responseBody.TopicResponses {
for _, partitionResponse := range topicResponse.PartitionResponses {
if len(partitionResponse.RecordBatches) == 0 {
Expand Down

0 comments on commit e7d11c9

Please sign in to comment.