Skip to content

Commit

Permalink
Allow to inherit ResoruceManager annotation
Browse files Browse the repository at this point in the history
Signed-off-by: David Kornel <[email protected]>
  • Loading branch information
kornys committed May 6, 2024
1 parent f327c58 commit 568b0da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.junit.jupiter.api.extension.ExtendWith;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

Expand All @@ -23,6 +24,7 @@
*/
@Target(ElementType.TYPE)
@Retention(RUNTIME)
@Inherited
@ExtendWith(ResourceManagerExtension.class)
@ExtendWith(ResourceManagerCleanerExtension.class)
public @interface ResourceManager {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.skodjob.testframe.test.integration;

import io.skodjob.testframe.annotations.ResourceManager;

@ResourceManager()
public class AbstractIT {
protected String nsName = "test";
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import io.fabric8.kubernetes.api.model.Namespace;
import io.fabric8.kubernetes.api.model.NamespaceBuilder;
import io.skodjob.testframe.annotations.ResourceManager;
import io.skodjob.testframe.annotations.TestVisualSeparator;
import io.skodjob.testframe.clients.KubeClusterException;
import io.skodjob.testframe.resources.KubeResourceManager;
Expand All @@ -20,15 +19,14 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;

@ResourceManager
@TestVisualSeparator
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class KubeResourceManagerCleanerIT {
public class KubeResourceManagerCleanerIT extends AbstractIT {

@BeforeAll
void setupAll() {
KubeResourceManager.getInstance().createResourceWithWait(
new NamespaceBuilder().withNewMetadata().withName("test").endMetadata().build());
new NamespaceBuilder().withNewMetadata().withName(nsName).endMetadata().build());
}

@BeforeEach
Expand Down

0 comments on commit 568b0da

Please sign in to comment.