@@ -17,14 +17,23 @@ function getConnectionsPairs(connections: Connection[]) {
1717 : conn . destination [ 'span.type' ] ;
1818 return `${ source } -> ${ destination } ` ;
1919 } )
20- . filter ( ( _ ) => _ )
21- . sort ( ) ;
20+ . filter ( ( _ ) => _ ) ;
2221}
2322
2423describe ( 'getConnections' , ( ) => {
2524 describe ( 'with environments defined' , ( ) => {
2625 const paths = [
2726 [
27+ {
28+ 'service.environment' : 'testing' ,
29+ 'service.name' : 'opbeans-ruby' ,
30+ 'agent.name' : 'ruby' ,
31+ } ,
32+ {
33+ 'service.environment' : null ,
34+ 'service.name' : 'opbeans-node' ,
35+ 'agent.name' : 'nodejs' ,
36+ } ,
2837 {
2938 'service.environment' : 'production' ,
3039 'service.name' : 'opbeans-go' ,
@@ -44,13 +53,13 @@ describe('getConnections', () => {
4453 [
4554 {
4655 'service.environment' : 'testing' ,
47- 'service.name' : 'opbeans-python ' ,
48- 'agent.name' : 'python ' ,
56+ 'service.name' : 'opbeans-ruby ' ,
57+ 'agent.name' : 'ruby ' ,
4958 } ,
5059 {
5160 'service.environment' : 'testing' ,
52- 'service.name' : 'opbeans-node ' ,
53- 'agent.name' : 'nodejs ' ,
61+ 'service.name' : 'opbeans-python ' ,
62+ 'agent.name' : 'python ' ,
5463 } ,
5564 {
5665 'span.subtype' : 'http' ,
@@ -66,12 +75,15 @@ describe('getConnections', () => {
6675 serviceName : undefined ,
6776 environment : undefined ,
6877 } ) ;
78+
6979 const connectionsPairs = getConnectionsPairs ( connections ) ;
7080 expect ( connectionsPairs ) . toEqual ( [
81+ 'opbeans-ruby:testing -> opbeans-node:null' ,
82+ 'opbeans-node:null -> opbeans-go:production' ,
7183 'opbeans-go:production -> opbeans-java:production' ,
7284 'opbeans-java:production -> external' ,
73- 'opbeans-node :testing -> external ' ,
74- 'opbeans-python:testing -> opbeans-node:testing ' ,
85+ 'opbeans-ruby :testing -> opbeans-python:testing ' ,
86+ 'opbeans-python:testing -> external ' ,
7587 ] ) ;
7688 } ) ;
7789 } ) ;
@@ -87,6 +99,8 @@ describe('getConnections', () => {
8799 const connectionsPairs = getConnectionsPairs ( connections ) ;
88100
89101 expect ( connectionsPairs ) . toEqual ( [
102+ 'opbeans-ruby:testing -> opbeans-node:null' ,
103+ 'opbeans-node:null -> opbeans-go:production' ,
90104 'opbeans-go:production -> opbeans-java:production' ,
91105 'opbeans-java:production -> external' ,
92106 ] ) ;
@@ -102,8 +116,8 @@ describe('getConnections', () => {
102116 const connectionsPairs = getConnectionsPairs ( connections ) ;
103117
104118 expect ( connectionsPairs ) . toEqual ( [
105- 'opbeans-node :testing -> external ' ,
106- 'opbeans-python:testing -> opbeans-node:testing ' ,
119+ 'opbeans-ruby :testing -> opbeans-python:testing ' ,
120+ 'opbeans-python:testing -> external ' ,
107121 ] ) ;
108122 } ) ;
109123 } ) ;
@@ -119,8 +133,10 @@ describe('getConnections', () => {
119133 const connectionsPairs = getConnectionsPairs ( connections ) ;
120134
121135 expect ( connectionsPairs ) . toEqual ( [
122- 'opbeans-node:testing -> external' ,
123- 'opbeans-python:testing -> opbeans-node:testing' ,
136+ 'opbeans-ruby:testing -> opbeans-node:null' ,
137+ 'opbeans-node:null -> opbeans-go:production' ,
138+ 'opbeans-go:production -> opbeans-java:production' ,
139+ 'opbeans-java:production -> external' ,
124140 ] ) ;
125141 } ) ;
126142 } ) ;
@@ -136,8 +152,12 @@ describe('getConnections', () => {
136152 const connectionsPairs = getConnectionsPairs ( connections ) ;
137153
138154 expect ( connectionsPairs ) . toEqual ( [
139- 'opbeans-node:testing -> external' ,
140- 'opbeans-python:testing -> opbeans-node:testing' ,
155+ 'opbeans-ruby:testing -> opbeans-node:null' ,
156+ 'opbeans-node:null -> opbeans-go:production' ,
157+ 'opbeans-go:production -> opbeans-java:production' ,
158+ 'opbeans-java:production -> external' ,
159+ 'opbeans-ruby:testing -> opbeans-python:testing' ,
160+ 'opbeans-python:testing -> external' ,
141161 ] ) ;
142162 } ) ;
143163 it ( 'shows all connections for production environment' , ( ) => {
@@ -150,6 +170,8 @@ describe('getConnections', () => {
150170 const connectionsPairs = getConnectionsPairs ( connections ) ;
151171
152172 expect ( connectionsPairs ) . toEqual ( [
173+ 'opbeans-ruby:testing -> opbeans-node:null' ,
174+ 'opbeans-node:null -> opbeans-go:production' ,
153175 'opbeans-go:production -> opbeans-java:production' ,
154176 'opbeans-java:production -> external' ,
155177 ] ) ;
@@ -160,6 +182,23 @@ describe('getConnections', () => {
160182 describe ( 'environment is "not defined"' , ( ) => {
161183 it ( 'shows all connections where environment is not set' , ( ) => {
162184 const environmentNotDefinedPaths = [
185+ [
186+ {
187+ 'service.environment' : 'production' ,
188+ 'service.name' : 'opbeans-go' ,
189+ 'agent.name' : 'go' ,
190+ } ,
191+ {
192+ 'service.environment' : 'production' ,
193+ 'service.name' : 'opbeans-java' ,
194+ 'agent.name' : 'java' ,
195+ } ,
196+ {
197+ 'span.subtype' : 'http' ,
198+ 'span.destination.service.resource' : '172.18.0.6:3000' ,
199+ 'span.type' : 'external' ,
200+ } ,
201+ ] ,
163202 [
164203 {
165204 'service.environment' : null ,
@@ -205,8 +244,8 @@ describe('getConnections', () => {
205244 expect ( connectionsPairs ) . toEqual ( [
206245 'opbeans-go:null -> opbeans-java:null' ,
207246 'opbeans-java:null -> external' ,
208- 'opbeans-node:null -> external' ,
209247 'opbeans-python:null -> opbeans-node:null' ,
248+ 'opbeans-node:null -> external' ,
210249 ] ) ;
211250 } ) ;
212251 } ) ;
0 commit comments