diff --git a/packages/metricsforwarder/spec b/packages/metricsforwarder/spec index f40b8e4e3f..e66957c2ff 100644 --- a/packages/metricsforwarder/spec +++ b/packages/metricsforwarder/spec @@ -8,6 +8,7 @@ files: - autoscaler/* - autoscaler/vendor/* - autoscaler/cf/* # gosub +- autoscaler/configutil/* # gosub - autoscaler/cred_helper/* # gosub - autoscaler/db/* # gosub - autoscaler/db/sqldb/* # gosub diff --git a/src/autoscaler/metricsforwarder/config/config_test.go b/src/autoscaler/metricsforwarder/config/config_test.go index aad1706ad4..ab7039b660 100644 --- a/src/autoscaler/metricsforwarder/config/config_test.go +++ b/src/autoscaler/metricsforwarder/config/config_test.go @@ -38,31 +38,20 @@ var _ = Describe("Config", func() { Describe("LoadConfig", func() { When("config is read from env", func() { - var vcapServicesJson string var expectedDbUrl string BeforeEach(func() { mockVCAPConfigurationReader = &fakes.FakeVCAPConfigurationReader{} }) - AfterEach(func() { - os.Unsetenv("VCAP_SERVICES") - os.Unsetenv("PORT") - os.Unsetenv("VCAP_APPLICATION") - }) - JustBeforeEach(func() { - os.Setenv("VCAP_APPLICATION", "{}") - os.Setenv("VCAP_SERVICES", vcapServicesJson) - mockVCAPConfigurationReader.IsRunningOnCFReturns(true) mockVCAPConfigurationReader.MaterializeDBFromServiceReturns(expectedDbUrl, nil) conf, err = LoadConfig(configFile, mockVCAPConfigurationReader) }) - When("PORT env variable is set to a number ", func() { + When("vcap PORT is set to a number ", func() { BeforeEach(func() { - vcapServicesJson = `{ "user-provided": [ { "name": "config" } ] }` mockVCAPConfigurationReader.GetPortReturns(3333) }) @@ -72,10 +61,9 @@ var _ = Describe("Config", func() { }) }) - When("VCAP_SERVICES is empty", func() { + When("service is empty", func() { var expectedErr error BeforeEach(func() { - vcapServicesJson = "{}" expectedErr = fmt.Errorf("Configuration error: metricsforwarder config service not found") mockVCAPConfigurationReader.GetServiceCredentialContentReturns([]byte(""), expectedErr) }) @@ -89,8 +77,6 @@ var _ = Describe("Config", func() { var expectedTLSConfig models.TLSCerts BeforeEach(func() { - vcapServicesJson = `{ "user-provided": [ { "name": "config", "credentials": { "metricsforwarder": { } } }] }` - expectedTLSConfig = models.TLSCerts{ CertFile: "/tmp/client_cert.sslcert", KeyFile: "/tmp/client_key.sslkey", diff --git a/src/autoscaler/mta.yaml b/src/autoscaler/mta.yaml index ab59e706d3..3b14d94d3f 100644 --- a/src/autoscaler/mta.yaml +++ b/src/autoscaler/mta.yaml @@ -25,6 +25,8 @@ resources: - name: config type: org.cloudfoundry.user-provided-service parameters: + service-tags: + - config path: metricsforwarder/default_config.json - name: policydb type: org.cloudfoundry.user-provided-service