Skip to content

[Question] Is it expected that @EnableKubeAPIServer and @KubeConfig are not inherited for tests in child classes? #7223

@michaelkoepf

Description

@michaelkoepf

Hi,

When using the @EnableKubeAPIServer and @KubeConfig in a parent class, the server does not start and the configuration is also not injected when running a test in a child class. Is this behavior expected?

Minimal reproducible example (see "NOTE" comments)

package com.example;

import io.fabric8.kubeapitest.junit.EnableKubeAPIServer;
import io.fabric8.kubeapitest.junit.KubeConfig;
import org.junit.jupiter.api.Test;

@EnableKubeAPIServer
public class KubeAPIServerTestBase {
  @KubeConfig
  static String kubeConfigYaml;

  @Test
  void testBase() {
    // NOTE: prints true, logs show that the server is started
    System.out.println(kubeConfigYaml != null);
  }
}
package com.example;

import org.junit.jupiter.api.Test;

public class KubeAPIServerTest extends KubeAPIServerTestBase {
  @Test
  void test() {
    // NOTE: prints false, logs show that server is NOT started
    System.out.println(kubeConfigYaml != null);
  }
}

Versions:

  • kube-api-test:7.3.1
  • openjdk version "17.0.15"

Thank you.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions