Skip to content

Commit d959f27

Browse files
committed
additional IT
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 14df0d2 commit d959f27

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

docs/reference.md

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ See sample usage within `Glue` [here](https://github.com/csviri/kubernetes-glue-
5353
The following attributes can be defined for a related resource:
5454

5555
- **`name`** - same as for child resource, unique identifier, used to reference the resource.
56+
- **`clusterScoped`** - if the related resource is cluster scoped. Default is `false`.
5657
- **`apiVersion`** - Kubernetes resource API Version of the resource
5758
- **`kind`** - Kubernetes kind property of the resource
5859
- **`resourceNames`** - list of string of the resource names within the same namespace as `Glue`.

src/test/java/io/csviri/operator/glue/GlueTest.java

+12
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,19 @@ void relatedResourceFromDifferentNamespace() {
308308

309309
@Test
310310
void clusterScopedRelatedResource() {
311+
var glue = create(TestUtils.loadGlue("/glue/ClusterScopedRelatedResource.yaml"));
311312

313+
await().untilAsserted(() -> {
314+
var cm = get(ConfigMap.class, "configmap1");
315+
assertThat(cm).isNotNull();
316+
assertThat(cm.getData()).containsEntry("phase", "Active");
317+
});
318+
319+
delete(glue);
320+
await().timeout(TestUtils.GC_WAIT_TIMEOUT).untilAsserted(() -> {
321+
var cm = get(ConfigMap.class, "configmap1");
322+
assertThat(cm).isNull();
323+
});
312324
}
313325

314326
private List<Glue> testWorkflowList(int num) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: io.csviri.operator.glue/v1beta1
2+
kind: Glue
3+
metadata:
4+
name: "testglue"
5+
spec:
6+
childResources:
7+
- name: configMap
8+
resource:
9+
apiVersion: v1
10+
kind: ConfigMap
11+
metadata:
12+
name: "configmap1"
13+
data:
14+
phase: "{related.status.phase}"
15+
relatedResources:
16+
- name: related
17+
apiVersion: v1
18+
kind: Namespace
19+
clusterScoped: true
20+
resourceNames: ["default"]
21+
22+

0 commit comments

Comments
 (0)