This is an automated email from the ASF dual-hosted git repository.

kvn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 53496e6  fix: set base url to seven module (#102)
53496e6 is described below

commit 53496e6847b4e086e881c63b8673559e183ae93e
Author: Alex Zhang <tok...@apache.org>
AuthorDate: Wed Dec 16 15:59:23 2020 +0800

    fix: set base url to seven module (#102)
    
    * fix: set base url to seven module
    
    * test: test conf.BaseUrl
---
 cmd/ingress/ingress.go      | 2 ++
 cmd/ingress/ingress_test.go | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/cmd/ingress/ingress.go b/cmd/ingress/ingress.go
index f07174b..679accc 100644
--- a/cmd/ingress/ingress.go
+++ b/cmd/ingress/ingress.go
@@ -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"
@@ -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)
                        }
diff --git a/cmd/ingress/ingress_test.go b/cmd/ingress/ingress_test.go
index b4460c9..144f753 100644
--- a/cmd/ingress/ingress_test.go
+++ b/cmd/ingress/ingress_test.go
@@ -25,6 +25,7 @@ import (
        "testing"
        "time"
 
+       "github.com/gxthrj/seven/conf"
        "github.com/stretchr/testify/assert"
 
        "github.com/api7/ingress-controller/pkg/config"
@@ -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 {

Reply via email to