From 982431e53da4e71b9114a0f562cb4f38ce395830 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 9 May 2017 09:00:03 +0100 Subject: [PATCH] Name change --- .../cmd/roomserver-integration-tests/main.go | 12 ++++++------ .../cmd/syncserver-integration-tests/main.go | 8 ++++---- .../matrix-org/dendrite/common/test/kafka.go | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/cmd/roomserver-integration-tests/main.go b/src/github.com/matrix-org/dendrite/cmd/roomserver-integration-tests/main.go index a31174211..f11c1c89c 100644 --- a/src/github.com/matrix-org/dendrite/cmd/roomserver-integration-tests/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/roomserver-integration-tests/main.go @@ -48,7 +48,7 @@ var ( testDatabase = defaulting(os.Getenv("DATABASE"), fmt.Sprintf("dbname=%s binary_parameters=yes", testDatabaseName)) ) -var env = test.KafkaEnv{ +var exe = test.KafkaExecutor{ ZookeeperURI: zookeeperURI, KafkaDirectory: kafkaDir, KafkaURI: kafkaURI, @@ -168,16 +168,16 @@ func testRoomserver(input []string, wantOutput []string, checkQueries func(api.R inputTopic = "roomserverInput" outputTopic = "roomserverOutput" ) - env.DeleteTopic(inputTopic) - if err := env.CreateTopic(inputTopic); err != nil { + exe.DeleteTopic(inputTopic) + if err := exe.CreateTopic(inputTopic); err != nil { panic(err) } - env.DeleteTopic(outputTopic) - if err := env.CreateTopic(outputTopic); err != nil { + exe.DeleteTopic(outputTopic) + if err := exe.CreateTopic(outputTopic); err != nil { panic(err) } - if err := env.WriteToTopic(inputTopic, canonicalJSONInput(input)); err != nil { + if err := exe.WriteToTopic(inputTopic, canonicalJSONInput(input)); err != nil { panic(err) } diff --git a/src/github.com/matrix-org/dendrite/cmd/syncserver-integration-tests/main.go b/src/github.com/matrix-org/dendrite/cmd/syncserver-integration-tests/main.go index 9e9a24577..03e5196c9 100644 --- a/src/github.com/matrix-org/dendrite/cmd/syncserver-integration-tests/main.go +++ b/src/github.com/matrix-org/dendrite/cmd/syncserver-integration-tests/main.go @@ -51,7 +51,7 @@ var ( const inputTopic = "syncserverInput" -var env = test.KafkaEnv{ +var exe = test.KafkaExecutor{ ZookeeperURI: zookeeperURI, KafkaDirectory: kafkaDir, KafkaURI: kafkaURI, @@ -146,11 +146,11 @@ func doSyncRequest(done chan error, want []string, since string) func() { } func testSyncServer(input, want []string, since string) { - env.DeleteTopic(inputTopic) - if err := env.CreateTopic(inputTopic); err != nil { + exe.DeleteTopic(inputTopic) + if err := exe.CreateTopic(inputTopic); err != nil { panic(err) } - if err := env.WriteToTopic(inputTopic, canonicalJSONInput(input)); err != nil { + if err := exe.WriteToTopic(inputTopic, canonicalJSONInput(input)); err != nil { panic(err) } diff --git a/src/github.com/matrix-org/dendrite/common/test/kafka.go b/src/github.com/matrix-org/dendrite/common/test/kafka.go index d8c677c15..cbf246304 100644 --- a/src/github.com/matrix-org/dendrite/common/test/kafka.go +++ b/src/github.com/matrix-org/dendrite/common/test/kafka.go @@ -21,8 +21,8 @@ import ( "strings" ) -// KafkaEnv contains the kafka environment information -type KafkaEnv struct { +// KafkaExecutor executes kafka scripts. +type KafkaExecutor struct { // The location of Zookeeper. Typically this is `localhost:2181`. ZookeeperURI string // The directory where Kafka is installed to. Used to locate kafka scripts. @@ -34,7 +34,7 @@ type KafkaEnv struct { } // CreateTopic creates a new kafka topic. This is created with a single partition. -func (e *KafkaEnv) CreateTopic(topic string) error { +func (e *KafkaExecutor) CreateTopic(topic string) error { cmd := exec.Command( filepath.Join(e.KafkaDirectory, "bin", "kafka-topics.sh"), "--create", @@ -49,7 +49,7 @@ func (e *KafkaEnv) CreateTopic(topic string) error { } // WriteToTopic writes data to a kafka topic. -func (e *KafkaEnv) WriteToTopic(topic string, data []string) error { +func (e *KafkaExecutor) WriteToTopic(topic string, data []string) error { cmd := exec.Command( filepath.Join(e.KafkaDirectory, "bin", "kafka-console-producer.sh"), "--broker-list", e.KafkaURI, @@ -62,7 +62,7 @@ func (e *KafkaEnv) WriteToTopic(topic string, data []string) error { } // DeleteTopic deletes a given kafka topic if it exists. -func (e *KafkaEnv) DeleteTopic(topic string) error { +func (e *KafkaExecutor) DeleteTopic(topic string) error { cmd := exec.Command( filepath.Join(e.KafkaDirectory, "bin", "kafka-topics.sh"), "--delete",