11import { V1Namespace } from '@kubernetes/client-node' ;
22import { config } from '../../../src/common/config' ;
33
4- import * as watchers from '../../../src/supervisor/watchers' ;
54import {
5+ extractNamespaceName ,
6+ isExcludedNamespace ,
67 kubernetesInternalNamespaces ,
78 openshiftInternalNamespaces ,
89} from '../../../src/supervisor/watchers/internal-namespaces' ;
@@ -14,14 +15,14 @@ describe('extractNamespaceName()', () => {
1415 [ 'undefined name' , { metadata : { name : undefined } } as V1Namespace ] ,
1516 [ 'empty name' , { metadata : { name : '' } } as V1Namespace ] ,
1617 ] ) ( 'throws on %s' , ( _testCaseName , input ) => {
17- expect ( ( ) => watchers . extractNamespaceName ( input ) ) . toThrowError (
18+ expect ( ( ) => extractNamespaceName ( input ) ) . toThrowError (
1819 'Namespace missing metadata.name' ,
1920 ) ;
2021 } ) ;
2122
2223 test ( 'returns namespace.metadata.name' , ( ) => {
2324 expect (
24- watchers . extractNamespaceName ( {
25+ extractNamespaceName ( {
2526 metadata : { name : 'literally anything else' } ,
2627 } ) ,
2728 ) . toEqual ( 'literally anything else' ) ;
@@ -35,7 +36,7 @@ describe('isExcludedNamespace() internal Kubernetes namespaces', () => {
3536
3637 for ( const internalNamespace of kubernetesInternalNamespaces ) {
3738 test ( `isExcludedNamespace(${ internalNamespace } ) -> true` , ( ) => {
38- expect ( watchers . isExcludedNamespace ( internalNamespace ) ) . toEqual ( true ) ;
39+ expect ( isExcludedNamespace ( internalNamespace ) ) . toEqual ( true ) ;
3940 } ) ;
4041 }
4142
@@ -47,7 +48,7 @@ describe('isExcludedNamespace() internal Kubernetes namespaces', () => {
4748 [ '' ] ,
4849 [ undefined as unknown as string ] ,
4950 ] ) ( 'isExcludedNamespace(%s) -> false' , ( input ) => {
50- expect ( watchers . isExcludedNamespace ( input ) ) . toEqual ( false ) ;
51+ expect ( isExcludedNamespace ( input ) ) . toEqual ( false ) ;
5152 } ) ;
5253} ) ;
5354
@@ -58,7 +59,7 @@ describe('isExcludedNamespace() openshift internal namespaces', () => {
5859
5960 for ( const internalNamespace of openshiftInternalNamespaces ) {
6061 test ( `isExcludedNamespace(${ internalNamespace } ) -> true` , ( ) => {
61- expect ( watchers . isExcludedNamespace ( internalNamespace ) ) . toEqual ( true ) ;
62+ expect ( isExcludedNamespace ( internalNamespace ) ) . toEqual ( true ) ;
6263 } ) ;
6364 }
6465
@@ -69,7 +70,7 @@ describe('isExcludedNamespace() openshift internal namespaces', () => {
6970 [ '' ] ,
7071 [ undefined as unknown as string ] ,
7172 ] ) ( 'isExcludedNamespace(%s) -> false' , ( input ) => {
72- expect ( watchers . isExcludedNamespace ( input ) ) . toEqual ( false ) ;
73+ expect ( isExcludedNamespace ( input ) ) . toEqual ( false ) ;
7374 } ) ;
7475} ) ;
7576
@@ -85,20 +86,20 @@ describe('isExcludedNamespace() excluded namespaces from config', () => {
8586
8687 excludedNamespacesFromConfig . forEach ( ( namespace ) => {
8788 test ( `[excluded namespaces from config] isExcludedNamespace(${ namespace } ) -> true` , ( ) => {
88- expect ( watchers . isExcludedNamespace ( namespace ) ) . toEqual ( true ) ;
89+ expect ( isExcludedNamespace ( namespace ) ) . toEqual ( true ) ;
8990 } ) ;
9091 } ) ;
9192
9293 for ( const internalNamespace of openshiftInternalNamespaces ) {
9394 test ( `[openshift internal namespaces] isExcludedNamespace(${ internalNamespace } ) -> true` , ( ) => {
94- expect ( watchers . isExcludedNamespace ( internalNamespace ) ) . toEqual ( true ) ;
95+ expect ( isExcludedNamespace ( internalNamespace ) ) . toEqual ( true ) ;
9596 } ) ;
9697 }
9798
9899 test . each ( [ [ 'kube-system' ] [ 'egg' ] , [ '' ] , [ undefined as unknown as string ] ] ) (
99100 'isExcludedNamespace(%s) -> false' ,
100101 ( input ) => {
101- expect ( watchers . isExcludedNamespace ( input ) ) . toEqual ( false ) ;
102+ expect ( isExcludedNamespace ( input ) ) . toEqual ( false ) ;
102103 } ,
103104 ) ;
104105} ) ;
0 commit comments