Name change

This commit is contained in:
Kegan Dougal 2017-05-09 09:00:03 +01:00
parent 7b56d66a2f
commit 982431e53d
3 changed files with 15 additions and 15 deletions

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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",