fix mock server
diff --git a/apigee_sync.go b/apigee_sync.go index d32635a..5928168 100644 --- a/apigee_sync.go +++ b/apigee_sync.go
@@ -325,8 +325,9 @@ log.Debug("download Snapshot for boot data") scopes := []string{apidInfo.ClusterID} - downloadSnapshot(scopes) + snapshot := downloadSnapshot(scopes) // note that for boot snapshot case, we don't need to inform plugins as they'll get the data snapshot + processSnapshot(&snapshot) } // use the scope IDs from the boot snapshot to get all the data associated with the scopes
diff --git a/cmd/mockServer/main.go b/cmd/mockServer/main.go index b9d507e..6773606 100644 --- a/cmd/mockServer/main.go +++ b/cmd/mockServer/main.go
@@ -30,6 +30,9 @@ f.Parse(os.Args[1:]) + // set listener binding before apid.Initialize() + os.Setenv("APID_API_LISTEN", ":9001") + apid.Initialize(factory.DefaultServicesFactory()) log := apid.Log() @@ -37,8 +40,6 @@ apidApigeeSync.SetLogger(log) config := apid.Config() - config.SetDefault("api_port", "9001") - router := apid.API().Router() params := apidApigeeSync.MockParms{ @@ -62,9 +63,9 @@ apidApigeeSync.Mock(params, router) // print the base url to the console - port := config.GetString("api_port") + listener := config.GetString("api_listen") log.Print() - log.Printf("API is at: http://localhost:%s", port) + log.Printf("API is bound to: %s", listener) log.Print() // start client API listener
diff --git a/mock_server.go b/mock_server.go index 23648e0..6800c9e 100644 --- a/mock_server.go +++ b/mock_server.go
@@ -13,6 +13,8 @@ "sync/atomic" "time" + "net" + "github.com/30x/apid-core" "github.com/apigee-labs/transicator/common" . "github.com/onsi/ginkgo" @@ -495,7 +497,10 @@ deploymentID := m.nextDeploymentID() bundleID := generateUUID() - port := apid.Config().GetString("api_port") + + listen := apid.Config().GetString("api_listen") + _, port, err := net.SplitHostPort(listen) + Expect(err).NotTo(HaveOccurred()) urlString := m.params.BundleURI if urlString == "" {