Skip to content

Commit

Permalink
fix: set base url to seven module (#102)
Browse files Browse the repository at this point in the history
* fix: set base url to seven module

* test: test conf.BaseUrl
  • Loading branch information
tokers authored Dec 16, 2020
1 parent 7be0167 commit 53496e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"time"

api6Informers "github.com/gxthrj/apisix-ingress-types/pkg/client/informers/externalversions"
"github.com/gxthrj/seven/conf"
"github.com/spf13/cobra"

"github.com/api7/ingress-controller/pkg/api"
Expand Down Expand Up @@ -86,6 +87,7 @@ func NewIngressCommand() *cobra.Command {
log.Info("use configuration\n", string(data))

// TODO: Move these logics to the inside of pkg/ingress/controller.
conf.SetBaseUrl(cfg.APISIX.BaseURL)
if err := kube.InitInformer(cfg); err != nil {
dief("failed to initialize kube informers: %s", err)
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/ingress/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"testing"
"time"

"github.com/gxthrj/seven/conf"
"github.com/stretchr/testify/assert"

"github.com/api7/ingress-controller/pkg/config"
Expand Down Expand Up @@ -130,6 +131,9 @@ func TestNewIngressCommandEffectiveLog(t *testing.T) {
assert.Equal(t, cfg.Kubernetes.ResyncInterval, types.TimeDuration{24 * time.Hour})
assert.Equal(t, cfg.APISIX.AdminKey, "0x123")
assert.Equal(t, cfg.APISIX.BaseURL, "http://apisixgw.default.cluster.local/apisix")

// Test the conf.BaseUrl is really set.
assert.Equal(t, cfg.APISIX.BaseURL, conf.BaseUrl)
}

func parseLog(t *testing.T, r *bufio.Reader) *fields {
Expand Down

0 comments on commit 53496e6

Please sign in to comment.