Skip to content

Commit 8cac567

Browse files
authored
Merge pull request #81 from philbrookes/AEROGEAR-2151
update CRD
2 parents ac209ff + a2778b3 commit 8cac567

7 files changed

+22
-9
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44

55
cmd/mobile/mobile
66
mobile
7-
87
coverage.out
98
integration.test

artifacts/mobileclient.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"spec": {
1515
"name": "myapp",
1616
"apiKey": "25113a4f-48b3-4dbb-b462-e2d388a475ac",
17-
"clientType": "cordova"
17+
"clientType": "cordova",
18+
"excludedServices": [
19+
"test",
20+
"test2"
21+
]
1822
}
1923
}

artifacts/mobileclient.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ Spec:
1111
clientType: iOS
1212
apiKey: 834d44f-d697-4c56-aec6-47940679f79a
1313
name: app2
14-
14+
excludedServices:
15+
- test1
16+
test2

artifacts/mobileclient_crd.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ spec:
3232
type: string
3333
pattern: '(\w-)'
3434
appIdentifier:
35-
type: string
35+
type: string
36+
excludedServices:
37+
type: array
38+
items:
39+
type: string

integration/client_delete_serviceInstance_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func deleteServiceInstance(t *testing.T, sid, namespace string) {
148148
cmd := exec.Command("oc", args...)
149149
output, err := cmd.CombinedOutput()
150150
if err != nil {
151-
t.Fatalf("Failed to delete service instance %s: %v, with output %v", sid, err, output)
151+
t.Fatalf("Failed to delete service instance %s: %v, with output %v", sid, err, string(output))
152152
}
153153
}
154154

@@ -186,6 +186,9 @@ func getInstance(si *ProvisionServiceParams) (instance *v1beta1.ServiceInstance,
186186
return nil, err
187187
}
188188

189+
if len(siList.Items) == 0 {
190+
return nil, errors.New("no matching instances found")
191+
}
189192
return &siList.Items[0], nil
190193
}
191194

integration/service_integration_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func TestIntegration(t *testing.T) {
139139
func CreateInstance(t *testing.T, si *ProvisionServiceParams) {
140140
args := []string{"create", "serviceinstance", si.ServiceName, si.Namespace}
141141
args = append(args, si.Params...)
142+
t.Logf("executing: %v\n", *executable+strings.Join(args, " "))
142143
cmd := exec.Command(*executable, args...)
143144

144145
output, err := cmd.CombinedOutput()

pkg/cmd/clients.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ func (cc *ClientCmd) ListClientsCmd() *cobra.Command {
6969
mClients := mobileClientList.(*v1alpha1.MobileClientList)
7070
var data [][]string
7171
for _, mClient := range mClients.Items {
72-
data = append(data, []string{mClient.Name, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.AppIdentifier})
72+
data = append(data, []string{mClient.Name, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.AppIdentifier, strings.Join(mClient.Spec.ExcludedServices, ", ")})
7373
}
7474
table := tablewriter.NewWriter(out)
7575
table.AppendBulk(data)
76-
table.SetHeader([]string{"ID", "Name", "ClientType", "AppIdentifier"})
76+
table.SetHeader([]string{"ID", "Name", "ClientType", "AppIdentifier", "ExcludedServices"})
7777
table.Render()
7878
return nil
7979
})
@@ -113,10 +113,10 @@ Run the "mobile get clients" command from this tool to get the client ID.`,
113113
cc.Out.AddRenderer(command.Name(), "table", func(out io.Writer, mobileClient interface{}) error {
114114
mClient := mobileClient.(*v1alpha1.MobileClient)
115115
var data [][]string
116-
data = append(data, []string{mClient.Name, mClient.Namespace, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.ApiKey, mClient.Spec.AppIdentifier})
116+
data = append(data, []string{mClient.Name, mClient.Namespace, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.ApiKey, mClient.Spec.AppIdentifier, strings.Join(mClient.Spec.ExcludedServices, ", ")})
117117
table := tablewriter.NewWriter(out)
118118
table.AppendBulk(data)
119-
table.SetHeader([]string{"ID", "Namespace", "Name", "ClientType", "ApiKey", "AppIdentifier"})
119+
table.SetHeader([]string{"ID", "Namespace", "Name", "ClientType", "ApiKey", "AppIdentifier", "Excluded Services"})
120120
table.Render()
121121
return nil
122122
})

0 commit comments

Comments
 (0)