File tree Expand file tree Collapse file tree
src/test/java/eu/openanalytics/containerproxy/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222
2323import io .fabric8 .kubernetes .api .model .Namespace ;
2424import io .fabric8 .kubernetes .api .model .NamespaceBuilder ;
25+ import io .fabric8 .kubernetes .api .model .Secret ;
2526import io .fabric8 .kubernetes .client .DefaultKubernetesClient ;
2627import io .fabric8 .kubernetes .client .NamespacedKubernetesClient ;
28+ import org .junit .jupiter .api .Assertions ;
2729
2830import java .util .Arrays ;
2931import java .util .List ;
32+ import java .util .stream .Collectors ;
3033
3134public abstract class KubernetesTestBase {
3235
@@ -88,4 +91,15 @@ private void createNamespaces() {
8891 }
8992 }
9093
94+
95+ protected List <Secret > getSecrets (String namespace ) {
96+ return client .secrets ().inNamespace (namespace ).list ().getItems ().stream ().filter (it -> !it .getMetadata ().getName ().startsWith ("default-token" )).collect (Collectors .toList ());
97+ }
98+
99+ protected Secret getSingleSecret (String namespace ) {
100+ List <Secret > secrets = getSecrets (namespace );
101+ Assertions .assertEquals (1 , secrets .size ());
102+ return secrets .get (0 );
103+ }
104+
91105}
You can’t perform that action at this time.
0 commit comments