-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
DynamicApiTest.groovy
26 lines (23 loc) · 1.01 KB
/
DynamicApiTest.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package io.kubernetes.client.e2e.dynamic
import io.kubernetes.client.openapi.models.V1Namespace
import io.kubernetes.client.openapi.models.V1ObjectMeta
import io.kubernetes.client.util.ClientBuilder
import io.kubernetes.client.util.generic.dynamic.DynamicKubernetesApi
import io.kubernetes.client.util.generic.dynamic.Dynamics
import spock.lang.Specification
class DynamicApiTest extends Specification {
def "Create Namespace then Delete should work"() {
given:
def apiClient = ClientBuilder.defaultClient()
def dynamicApi = new DynamicKubernetesApi("", "v1", "namespaces", apiClient)
def namespaceFoo = new V1Namespace().metadata(new V1ObjectMeta().name("e2e-dynamic"))
when:
def createdNamespace = dynamicApi.create(Dynamics.newFromJson(apiClient.getJSON().serialize(namespaceFoo)))
then:
createdNamespace != null
when:
def deleted = dynamicApi.delete("e2e-dynamic").throwsApiException().getObject()
then:
deleted != null
}
}