Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]Fix the testing for gRPC client #40

Merged
merged 4 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ notifications:

before_install:
- go get -u github.com/kardianos/govendor
- sudo apt-get install -y git build-essential openvswitch-switch
- docker run -d -v /run/openvswitch/db.sock:/var/run/openvswitch/db.sock -p 50051:50051 sdnvortex/network-controller:latest /go/bin/server -tcp=0.0.0.0:50051

install:
- make pre-build

script:
- make build
- make test
- make src.test-coverage
- sudo -E PATH=$PATH TEST_GRPC=1 make src.test-coverage
- docker build --tag sdnvortex/vortex --file ./dockerfiles/Dockerfile .

before_deploy:
Expand Down
8 changes: 5 additions & 3 deletions src/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ type Config struct {
Mongo *mongo.MongoConfig `json:"mongo"`
Logger logger.LoggerConfig `json:"logger"`

Kubernetes *rest.Config `json:"kubernetes"`
// the version settings of the current application
Version string `json:"version"`

Kubernetes *rest.Config `json:"kubernetes"`
}

func Read(path string) (c Config, err error) {
Expand All @@ -34,14 +33,17 @@ func Read(path string) (c Config, err error) {
if err := decoder.Decode(&c); err != nil {
return c, fmt.Errorf("Failed to load the config file: %v\n", err)
}

// FIXME, we need to find a way to test the fakeclient evne if we don't install the k8s
kubeconfig := filepath.Join(os.Getenv("HOME"), ".kube", "config")
c.Kubernetes, err = clientcmd.BuildConfigFromFlags("", kubeconfig)
if err != nil {
c.Kubernetes, err = rest.InClusterConfig()
if err != nil {
return c, fmt.Errorf("Failed to open the kubernetes config file: %v\n", err)
fmt.Errorf("Load the kubernetes config fail, use the fake k8s clinet instead")
}
}

return c, nil
}

Expand Down
Loading