File tree Expand file tree Collapse file tree 5 files changed +30
-5
lines changed
src/test/java/io/skodjob/testframe/test/integration Expand file tree Collapse file tree 5 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 9595 <artifactId >test-frame-common</artifactId >
9696 <version >${project.version} </version >
9797 </dependency >
98+ <dependency >
99+ <groupId >io.skodjob</groupId >
100+ <artifactId >test-frame-kubernetes</artifactId >
101+ <version >${project.version} </version >
102+ </dependency >
98103 <dependency >
99104 <groupId >io.fabric8</groupId >
100105 <artifactId >kubernetes-client-api</artifactId >
Original file line number Diff line number Diff line change 3030 <groupId >io.skodjob</groupId >
3131 <artifactId >test-frame-common</artifactId >
3232 </dependency >
33+ <dependency >
34+ <groupId >io.skodjob</groupId >
35+ <artifactId >test-frame-kubernetes</artifactId >
36+ </dependency >
3337 <dependency >
3438 <groupId >io.fabric8</groupId >
3539 <artifactId >openshift-client</artifactId >
101105 </executions >
102106 <configuration >
103107 <skipITs >${it.skip} </skipITs >
104- <forkCount >0 </forkCount >
108+ <forkCount >1 </forkCount >
105109 <includes >
106110 <include >io.skodjob.testframe.test.integration.**</include >
107111 </includes >
Original file line number Diff line number Diff line change 11package io .skodjob .testframe .test .integration ;
22
33import io .skodjob .testframe .annotations .ResourceManager ;
4+ import io .skodjob .testframe .resources .KubeResourceManager ;
5+ import io .skodjob .testframe .resources .NamespaceResource ;
6+ import io .skodjob .testframe .resources .ServiceAccountResource ;
7+ import io .skodjob .testframe .utils .KubeUtils ;
48
5- @ ResourceManager ()
9+ @ ResourceManager
610public class AbstractIT {
11+ static {
12+ KubeResourceManager .getInstance ().setResourceTypes (
13+ new NamespaceResource (),
14+ new ServiceAccountResource ()
15+ );
16+ KubeResourceManager .getInstance ().addCreateCallback (r -> {
17+ if (r .getKind ().equals ("Namespace" )) {
18+ KubeUtils .labelNamespace (r .getMetadata ().getName (), "test-label" , "true" );
19+ }
20+ });
21+ }
22+
723 protected String nsName = "test" ;
824}
Original file line number Diff line number Diff line change 55package io .skodjob .testframe .test .integration ;
66
77import io .fabric8 .kubernetes .api .model .HasMetadata ;
8- import io .skodjob .testframe .annotations .ResourceManager ;
98import io .skodjob .testframe .annotations .TestVisualSeparator ;
109import io .skodjob .testframe .resources .KubeResourceManager ;
1110import org .junit .jupiter .api .Test ;
1615
1716import static org .junit .jupiter .api .Assertions .assertNotNull ;
1817
19- @ ResourceManager
2018@ TestVisualSeparator
2119@ TestInstance (TestInstance .Lifecycle .PER_CLASS )
22- public class KubeClientIT {
20+ public class KubeClientIT extends AbstractIT {
2321
2422 @ Test
2523 void testCreateResourcesFromYaml () throws IOException {
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ void createResource() {
4646 Namespace ns = new NamespaceBuilder ().withNewMetadata ().withName ("test3" ).endMetadata ().build ();
4747 KubeResourceManager .getInstance ().createResourceWithWait (ns );
4848 KubeResourceManager .getInstance ().createOrUpdateResourceWithWait (ns );
49+ assertNotNull (KubeResourceManager .getKubeClient ().getClient ().namespaces ().withName ("test3" ).get ()
50+ .getMetadata ().getLabels ().get ("test-label" ));
4951 }
5052
5153 @ Test
You can’t perform that action at this time.
0 commit comments