Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
fix the fake_test
Browse files Browse the repository at this point in the history
  • Loading branch information
ideahitme committed Jan 20, 2017
1 parent 428aed9 commit a0f21d1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
11 changes: 7 additions & 4 deletions config/config.go → config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package config
package main

import kingpin "gopkg.in/alecthomas/kingpin.v2"
import "net/url"
import (
"net/url"

kingpin "gopkg.in/alecthomas/kingpin.v2"
)

type MateConfig struct {
Producer string
Expand All @@ -27,7 +30,7 @@ type MateConfig struct {
GoogleRecordGroupID string
}

func New(version string) *MateConfig {
func NewConfig(version string) *MateConfig {
kingpin.Version(version)
return &MateConfig{}
}
Expand Down
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

log "github.com/Sirupsen/logrus"

"github.com/zalando-incubator/mate/config"
"github.com/zalando-incubator/mate/consumers"
"github.com/zalando-incubator/mate/controller"
"github.com/zalando-incubator/mate/producers"
Expand All @@ -14,7 +13,7 @@ import (
var version = "Unknown"

func main() {
cfg := config.New(version)
cfg := NewConfig(version)

cfg.ParseFlags()

Expand Down Expand Up @@ -47,7 +46,7 @@ func main() {
ctrl.Wait()
}

func newSyncConsumer(cfg *config.MateConfig) (consumers.Consumer, error) {
func newSyncConsumer(cfg *MateConfig) (consumers.Consumer, error) {
// New returns a Consumer implementation.
var consumer consumers.Consumer
var err error
Expand All @@ -67,7 +66,7 @@ func newSyncConsumer(cfg *config.MateConfig) (consumers.Consumer, error) {
return consumers.NewSynced(consumer)
}

func newProducer(cfg *config.MateConfig) (producers.Producer, error) {
func newProducer(cfg *MateConfig) (producers.Producer, error) {
switch cfg.Producer {
case "kubernetes":
kubeConfig := &producers.KubernetesOptions{
Expand Down
3 changes: 3 additions & 0 deletions producers/fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import (
const (
defaultFakeDomain = "example.org."
defaultFakeMode = "ip"
ipMode = "ip"
hostnameMode = "hostname"
fixedMode = "fixed"
)

type fakeProducer struct {
Expand Down
9 changes: 5 additions & 4 deletions producers/fake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ func TestFakeEndpointsResolveToHostnamesInHostnameMode(t *testing.T) {
}

func TestNewFakeReadsConfigurationFromParams(t *testing.T) {
fakeParams.dnsName = "dnsName"
fakeParams.mode = "mode"
fakeParams.targetDomain = "targetDomain"
fakeParams := &FakeProducerOptions{}
fakeParams.DNSName = "dnsName"
fakeParams.Mode = "mode"
fakeParams.TargetDomain = "targetDomain"

producer, err := NewFake()
producer, err := NewFake(fakeParams)
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit a0f21d1

Please sign in to comment.