Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
giosakti committed Dec 15, 2018
1 parent 66bb89f commit 1253b61
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions cmds/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,17 @@ import (
"testing"

"github.com/BaritoLog/go-boilerplate/saramatestkit"
. "github.com/BaritoLog/go-boilerplate/testkit"
log "github.com/sirupsen/logrus"
)

func init() {
log.SetLevel(log.ErrorLevel)
}

// func TestProducer(t *testing.T) {
// kafkaProducer := mocks.NewSyncProducer(nil, sarama.NewConfig())
//
// patch := saramatestkit.PatchNewSyncProducer(kafkaProducer, nil)
// defer patch.Unpatch()
//
// os.Setenv(EnvProducerAddress, "asdf")
// defer os.Clearenv()
//
// err := ActionBaritoProducerService(nil)
// FatalIfWrongError(t, err, "listen tcp: address asdf: missing port in address")
// }

func TestProducer_KafkaError(t *testing.T) {
patch := saramatestkit.PatchNewSyncProducer(nil, fmt.Errorf("some-error"))
defer patch.Unpatch()

os.Setenv(EnvKafkaBrokers, "wronghost:2349")
defer os.Clearenv()

err := ActionBaritoProducerService(nil)
FatalIfWrongError(t, err, "some-error")
}

0 comments on commit 1253b61

Please sign in to comment.