Skip to content

Commit

Permalink
update integrations, remove unit tests from integration target
Browse files Browse the repository at this point in the history
  • Loading branch information
maleck13 committed Jan 25, 2018
1 parent 0b24745 commit 5a9a36b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fmt:
check: errcheck vet fmt test-unit

.PHONY: integration
integration: build
integration: build_binary
go test -v ./integration -args -namespace=`oc project -q` -executable=`pwd`/mobile

.PHONY: release
Expand Down
22 changes: 16 additions & 6 deletions integration/client_crudl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ import (
)

type MobileClientSpec struct {
Name string
ApiKey string
ClientType string
Name string
ApiKey string
ClientType string
AppIdentifier string
}

type MobileClientJson struct {
Spec MobileClientSpec
}

func ValidMobileClientJson(name string, clientType string) func(output []byte, err error) ValidationResult {
func ValidMobileClientJson(name, clientType, appIdentifier string) func(output []byte, err error) ValidationResult {
return func(output []byte, err error) ValidationResult {
var parsed MobileClientJson
if err := json.Unmarshal([]byte(output), &parsed); err != nil {
Expand All @@ -31,6 +32,14 @@ func ValidMobileClientJson(name string, clientType string) func(output []byte, e
Output: output,
}
}
if parsed.Spec.AppIdentifier != appIdentifier {
return ValidationResult{
Success: false,
Message: []string{fmt.Sprintf("Expected the AppIdentifier to be %s, but got %s", appIdentifier, parsed.Spec.AppIdentifier)},
Error: err,
Output: output,
}
}
if parsed.Spec.Name != name {
return ValidationResult{
Success: false,
Expand All @@ -52,18 +61,19 @@ func TestClientJson(t *testing.T) {
}

name := fmt.Sprintf("%s-mobile-crud-test-entity", *prefix)
appIdentifier := "my.app.org"
m := ValidatedCmd(*executable, fmt.Sprintf("--namespace=%s", *namespace), "-o=json")
o := ValidatedCmd("oc", fmt.Sprintf("--namespace=%s", *namespace), "-o=json")
for _, clientType := range clientTypes {
t.Run(clientType, func(t *testing.T) {
expectedId := strings.ToLower(fmt.Sprintf("%s-%s", name, clientType))

notExists := All(IsErr, ValidRegex(fmt.Sprintf(".*\"%s\" not found.*", expectedId)))
exists := All(NoErr, ValidMobileClientJson(name, clientType))
exists := All(NoErr, ValidMobileClientJson(name, clientType, appIdentifier))

m.Args("get", "client", expectedId).Should(notExists).Run().Test(t)
o.Args("get", "mobileclient", expectedId).Should(notExists).Run().Test(t)
m.Args("create", "client", name, clientType).Should(exists).Run().Test(t)
m.Args("create", "client", name, clientType, appIdentifier).Should(exists).Run().Test(t)
m.Args("get", "client", expectedId).Should(exists).Run().Test(t)
o.Args("get", "mobileclient", expectedId).Should(exists).Run().Test(t)
m.Args("delete", "client", expectedId).Should(NoErr).Run().Test(t)
Expand Down
2 changes: 1 addition & 1 deletion integration/getServicesTestData/json-output.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"metadata":{},"items":[{"metadata":{"name":"1522a4d0e2fbf86a26cbe096eb1b6b2d","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/1522a4d0e2fbf86a26cbe096eb1b6b2d","uid":"f245ebb9-fb89-11e7-b96a-0242ac110002","resourceVersion":"30","creationTimestamp":"2018-01-17T13:25:55Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-unifiedpush-apb","externalID":"1522a4d0e2fbf86a26cbe096eb1b6b2d","description":"AeroGear UnifiedPush Server","bindable":true,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"dependencies":["MySQL:55"],"displayName":"AeroGear UPS","documentationUrl":"https://aerogear.org/push","imageUrl":"https://pbs.twimg.com/profile_images/1794440005/aerogear_icon-1_400x400.png","providerDisplayName":"Red Hat, Inc.","serviceName":"ups"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"2b825339e8d685a78476621a252beea8","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/2b825339e8d685a78476621a252beea8","uid":"f2661c87-fb89-11e7-b96a-0242ac110002","resourceVersion":"37","creationTimestamp":"2018-01-17T13:25:55Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-3scale-apb","externalID":"2b825339e8d685a78476621a252beea8","description":"Unlock the power of your APIs. This will deploy Apicast to your Openshift cluster and connect it to a dedicated Redis. For this to function correctly it needs to be configured with a token and domain for the account it should pull it's configuration values from (usually in 3scale.net).\nYou can create an account with 3scale.net here: https://www.3scale.net/signup/\n","bindable":true,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"displayName":"3Scale","documentationUrl":"https://www.3scale.net/api-management/interactive-api-documentation/","imageUrl":"https://avatars1.githubusercontent.com/u/21415?s=200\u0026v=4","providerDisplayName":"Red Hat, Inc.","serviceName":"3scale"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"9623d53183cc78619f888ea8499c678e","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/9623d53183cc78619f888ea8499c678e","uid":"f2473a79-fb89-11e7-b96a-0242ac110002","resourceVersion":"32","creationTimestamp":"2018-01-17T13:25:55Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-metrics-apb","externalID":"9623d53183cc78619f888ea8499c678e","description":"Installs a metrics service based on Prometheus and Grafana","bindable":false,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"displayName":"Metrics","documentationUrl":"https://prometheus.io/docs/introduction/overview/","imageUrl":"https://avatars1.githubusercontent.com/u/3380462?s=200\u0026v=4","providerDisplayName":"Red Hat, Inc.","serviceName":"prometheus"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"a0c0c2478554458d5c77abc95f0473a3","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/a0c0c2478554458d5c77abc95f0473a3","uid":"f2469a3a-fb89-11e7-b96a-0242ac110002","resourceVersion":"31","creationTimestamp":"2018-01-17T13:25:55Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-aerogear-digger-apb","externalID":"a0c0c2478554458d5c77abc95f0473a3","description":"Mobile CI/CD service that integrates with Jenkins Pipelines to test and build your mobile binaries.","bindable":false,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"displayName":"Mobile CI/CD","documentationUrl":"https://aerogear.org/digger/","imageUrl":"https://aerogear.org/img/aerogeardigger_icon_32px_cropped.png","longDescription":"To use the Mobile CI/CD service you must first agree to the Android SDK License Agreement. By checking this box you are agreeing to the Android Software Development Kit License agreement which can be read at the following URL: https://developer.android.com/studio/terms.html\n\n. If the box is not checked the installer will take no action.","providerDisplayName":"Red Hat, Inc.","serviceName":"aerogear-digger-apb"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"b95513950bb3f132de25d58fb75f8dca","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/b95513950bb3f132de25d58fb75f8dca","uid":"f2499c77-fb89-11e7-b96a-0242ac110002","resourceVersion":"36","creationTimestamp":"2018-01-17T13:25:55Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-keycloak-apb","externalID":"b95513950bb3f132de25d58fb75f8dca","description":"Keycloak - Open Source Identity and Access Management","bindable":true,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"dependencies":["Postgresql:9.5"],"displayName":"Keycloak","documentationUrl":"http://www.keycloak.org/documentation.html","imageUrl":"https://pbs.twimg.com/profile_images/702119821979344897/oAC05cEB_400x400.png","providerDisplayName":"Red Hat, Inc.","serviceName":"keycloak"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"c57e94c36c1e7f6bb41cf7c589d9eb08","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/c57e94c36c1e7f6bb41cf7c589d9eb08","uid":"f28461c0-fb89-11e7-b96a-0242ac110002","resourceVersion":"38","creationTimestamp":"2018-01-17T13:25:55Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-fh-sync-server-apb","externalID":"c57e94c36c1e7f6bb41cf7c589d9eb08","description":"The FeedHenry Sync Server APB","bindable":false,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"displayName":"FeedHenry Sync Server","documentationUrl":"http://feedhenry.org/projects/#data-synchronization","imageUrl":"https://avatars3.githubusercontent.com/u/772226?s=200\u0026v=4","integrations":"keycloak,apiKeys","providerDisplayName":"Red Hat, Inc.","serviceName":"fh-sync-server"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}}]}
{"metadata":{},"items":[{"metadata":{"name":"1522a4d0e2fbf86a26cbe096eb1b6b2d","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/1522a4d0e2fbf86a26cbe096eb1b6b2d","uid":"470ef9e9-01cf-11e8-a8d5-0242ac110002","resourceVersion":"3877","creationTimestamp":"2018-01-25T12:57:19Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-unifiedpush-apb","externalID":"1522a4d0e2fbf86a26cbe096eb1b6b2d","description":"AeroGear UnifiedPush Server","bindable":true,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"dependencies":["MySQL:55"],"displayName":"AeroGear UPS","documentationUrl":"https://aerogear.org/push","imageUrl":"https://pbs.twimg.com/profile_images/1794440005/aerogear_icon-1_400x400.png","providerDisplayName":"Red Hat, Inc.","serviceName":"ups"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"2b825339e8d685a78476621a252beea8","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/2b825339e8d685a78476621a252beea8","uid":"470ba629-01cf-11e8-a8d5-0242ac110002","resourceVersion":"3873","creationTimestamp":"2018-01-25T12:57:19Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-3scale-apb","externalID":"2b825339e8d685a78476621a252beea8","description":"Unlock the power of your APIs. This will deploy Apicast to your Openshift cluster and connect it to a dedicated Redis. For this to function correctly it needs to be configured with a token and domain for the account it should pull it's configuration values from (usually in 3scale.net).\nYou can create an account with 3scale.net here: https://www.3scale.net/signup/\n","bindable":true,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"displayName":"3Scale","documentationUrl":"https://www.3scale.net/api-management/interactive-api-documentation/","imageUrl":"https://avatars1.githubusercontent.com/u/21415?s=200\u0026v=4","providerDisplayName":"Red Hat, Inc.","serviceName":"3scale"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"9623d53183cc78619f888ea8499c678e","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/9623d53183cc78619f888ea8499c678e","uid":"470fa7f2-01cf-11e8-a8d5-0242ac110002","resourceVersion":"3878","creationTimestamp":"2018-01-25T12:57:19Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-metrics-apb","externalID":"9623d53183cc78619f888ea8499c678e","description":"Installs a metrics service based on Prometheus and Grafana","bindable":false,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"displayName":"Metrics","documentationUrl":"https://prometheus.io/docs/introduction/overview/","imageUrl":"https://avatars1.githubusercontent.com/u/3380462?s=200\u0026v=4","providerDisplayName":"Red Hat, Inc.","serviceName":"prometheus"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"a0c0c2478554458d5c77abc95f0473a3","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/a0c0c2478554458d5c77abc95f0473a3","uid":"470c4ca8-01cf-11e8-a8d5-0242ac110002","resourceVersion":"3874","creationTimestamp":"2018-01-25T12:57:19Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-aerogear-digger-apb","externalID":"a0c0c2478554458d5c77abc95f0473a3","description":"Mobile CI/CD service that integrates with Jenkins Pipelines to test and build your mobile binaries.","bindable":false,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"displayName":"Mobile CI/CD","documentationUrl":"https://aerogear.org/digger/","imageUrl":"https://aerogear.org/img/aerogeardigger_icon_32px_cropped.png","longDescription":"To use the Mobile CI/CD service you must first agree to the Android SDK License Agreement. By checking this box you are agreeing to the Android Software Development Kit License agreement which can be read at the following URL: https://developer.android.com/studio/terms.html\n\n. If the box is not checked the installer will take no action.","providerDisplayName":"Red Hat, Inc.","serviceName":"aerogear-digger-apb"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"b95513950bb3f132de25d58fb75f8dca","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/b95513950bb3f132de25d58fb75f8dca","uid":"470cecdf-01cf-11e8-a8d5-0242ac110002","resourceVersion":"3875","creationTimestamp":"2018-01-25T12:57:19Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-keycloak-apb","externalID":"b95513950bb3f132de25d58fb75f8dca","description":"Keycloak - Open Source Identity and Access Management","bindable":true,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"dependencies":["Postgresql:9.5"],"displayName":"Keycloak","documentationUrl":"http://www.keycloak.org/documentation.html","imageUrl":"https://pbs.twimg.com/profile_images/702119821979344897/oAC05cEB_400x400.png","providerDisplayName":"Red Hat, Inc.","serviceName":"keycloak"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}},{"metadata":{"name":"c57e94c36c1e7f6bb41cf7c589d9eb08","selfLink":"/apis/servicecatalog.k8s.io/v1beta1/clusterserviceclasses/c57e94c36c1e7f6bb41cf7c589d9eb08","uid":"470e546c-01cf-11e8-a8d5-0242ac110002","resourceVersion":"3876","creationTimestamp":"2018-01-25T12:57:19Z"},"spec":{"clusterServiceBrokerName":"ansible-service-broker","externalName":"dh-fh-sync-server-apb","externalID":"c57e94c36c1e7f6bb41cf7c589d9eb08","description":"The FeedHenry Sync Server APB","bindable":false,"binding_retrievable":false,"planUpdatable":false,"externalMetadata":{"console.openshift.io/iconClass":"font-icon icon-nodejs","displayName":"FeedHenry Sync Server","integrations":"keycloak,apiKeys","serviceName":"fh-sync-server"},"tags":["mobile-service"]},"status":{"removedFromBrokerCatalog":false}}]}

0 comments on commit 5a9a36b

Please sign in to comment.