Skip to content

Commit

Permalink
Split tests of current and legacy components
Browse files Browse the repository at this point in the history
* Run the split tests in separate travis jobs
* Cache maven artifacts
* Update Linux and Go versions to current
  • Loading branch information
silvestre committed Oct 30, 2019
1 parent 0cce93e commit 8904e44
Show file tree
Hide file tree
Showing 19 changed files with 2,433 additions and 59 deletions.
89 changes: 52 additions & 37 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@


dist: trusty
sudo: required
os: linux
dist: xenial

env:
global:
- DBURL=postgres://postgres@localhost/autoscaler?sslmode=disable
- NODE_VERSION=6.2
- GO_VERSION=1.11
- GO_VERSION=1.13.3
- LOGLEVEL=info
language: java
cache:
directories:
- $HOME/.m2
jdk:
- openjdk8
- openjdk8
services:
- postgresql
addons:
Expand All @@ -37,36 +38,50 @@ before_script:
- java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=src/autoscaler/scalingengine/db/scalingengine.db.changelog.yml update
- java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=src/autoscaler/operator/db/operator.db.changelog.yml update

matrix:
jobs:
include:
- name: unit test
script:
# Unit test
- pushd api
- npm install
- npm test
- popd
- pushd servicebroker
- npm install
- npm test
- popd
- pushd src/autoscaler
- ginkgo -r -race -randomizeAllSpecs
- popd
- pushd scheduler
- mvn test
- popd
- name: unit test
script:
# Unit test
- pushd src/autoscaler
- ginkgo -r -race -randomizeAllSpecs
- popd
- pushd scheduler
- mvn test
- popd

- name: integration test
script:
# Integration test
- pushd scheduler
- mvn package -DskipTests
- popd
- ginkgo -r -race -randomizeAllSpecs src/integration

# Tests for legacy components (node apiserver, broker and metricscollector)
- name: legacy unit test
script:
- pushd api
- npm install
- npm test
- popd
- pushd servicebroker
- npm install
- npm test
- popd

- name: legacy integration test
script:
- pushd api
- npm install
- npm test
- popd
- pushd servicebroker
- npm install
- npm test
- popd
- pushd scheduler
- mvn package -DskipTests
- popd
- ginkgo -r -race -randomizeAllSpecs src/integration_legacy

- name: integration test
script:
# Integration test
- pushd api
- npm install
- popd
- pushd servicebroker
- npm install
- popd
- pushd scheduler
- mvn package -DskipTests
- popd
- ginkgo -r -race -randomizeAllSpecs src/integration
19 changes: 11 additions & 8 deletions src/autoscaler/db/sqldb/binding_sqldb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,19 @@ var _ = Describe("BindingSqldb", func() {
It("should return what was created", func() {
Expect(retrievedServiceInstance).To(Equal(&models.ServiceInstance{testInstanceId, testOrgGuid, testSpaceGuid, policyJsonStr, policyGuid}))
})
Context("When the service instance doesn't have a default policy", func() {
BeforeEach(func() {
policyJsonStr = ""
})
It("should return an empty default policy", func() {
Expect(err).NotTo(HaveOccurred())
Expect(retrievedServiceInstance.DefaultPolicy).To(BeEmpty())
})
})
Context("when the service instance doesn't have a default policy", func() {
BeforeEach(func() {
err = bdb.CreateServiceInstance(models.ServiceInstance{testInstanceId, testOrgGuid, testSpaceGuid, "", ""})
Expect(err).NotTo(HaveOccurred())
})
It("should return an empty default policy", func() {
Expect(err).NotTo(HaveOccurred())
Expect(retrievedServiceInstance.DefaultPolicy).To(BeEmpty())
Expect(retrievedServiceInstance.DefaultPolicyGuid).To(BeEmpty())
})
})

})

Describe("CreateServiceBinding", func() {
Expand Down
18 changes: 18 additions & 0 deletions src/integration/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ type AppInstanceMetricResult struct {
Resources []models.AppInstanceMetric `json:"resources"`
}

type AppAggregatedMetricResult struct {
TotalResults int `json:"total_results"`
TotalPages int `json:"total_pages"`
Page int `json:"page"`
PrevUrl string `json:"prev_url"`
NextUrl string `json:"next_url"`
Resources []models.AppMetric `json:"resources"`
}

type ScalingHistoryResult struct {
TotalResults int `json:"total_results"`
TotalPages int `json:"total_pages"`
Page int `json:"page"`
PrevUrl string `json:"prev_url"`
NextUrl string `json:"next_url"`
Resources []models.AppScalingHistory `json:"resources"`
}

func getAppAggregatedMetricUrl(appId string, metricType string, parameteters map[string]string, pageNo int) string {
return fmt.Sprintf("/v1/apps/%s/aggregated_metric_histories/%s?any=any&start-time=%s&end-time=%s&order-direction=%s&page=%d&results-per-page=%s", appId, metricType, parameteters["start-time"], parameteters["end-time"], parameteters["order-direction"], pageNo, parameteters["results-per-page"])
}
Expand Down
Loading

0 comments on commit 8904e44

Please sign in to comment.