@@ -39,7 +39,8 @@ module('Integration | Component | TopoViz', function(hooks) {
39
39
@nodes={{this.nodes}}
40
40
@allocations={{this.allocations}}
41
41
@onAllocationSelect={{this.onAllocationSelect}}
42
- @onNodeSelect={{this.onNodeSelect}} />
42
+ @onNodeSelect={{this.onNodeSelect}}
43
+ @onDataError={{this.onDataError}} />
43
44
` ;
44
45
45
46
test ( 'presents as a FlexMasonry of datacenters' , async function ( assert ) {
@@ -167,4 +168,35 @@ module('Integration | Component | TopoViz', function(hooks) {
167
168
await TopoViz . datacenters [ 0 ] . nodes [ 0 ] . memoryRects [ 0 ] . select ( ) ;
168
169
assert . equal ( TopoViz . allocationAssociations . length , 0 ) ;
169
170
} ) ;
171
+
172
+ test ( 'when one or more nodes are missing the resources property, those nodes are filtered out of the topology view and onDataError is called' , async function ( assert ) {
173
+ const badNode = node ( 'dc1' , 'node0' , 1000 , 500 ) ;
174
+ delete badNode . resources ;
175
+
176
+ this . setProperties ( {
177
+ nodes : [ badNode , node ( 'dc1' , 'node1' , 1000 , 500 ) ] ,
178
+ allocations : [
179
+ alloc ( 'node0' , 'job1' , 'group' , 100 , 100 ) ,
180
+ alloc ( 'node0' , 'job1' , 'group' , 100 , 100 ) ,
181
+ alloc ( 'node1' , 'job1' , 'group' , 100 , 100 ) ,
182
+ alloc ( 'node1' , 'job1' , 'group' , 100 , 100 ) ,
183
+ alloc ( 'node0' , 'job1' , 'groupTwo' , 100 , 100 ) ,
184
+ ] ,
185
+ onNodeSelect : sinon . spy ( ) ,
186
+ onAllocationSelect : sinon . spy ( ) ,
187
+ onDataError : sinon . spy ( ) ,
188
+ } ) ;
189
+
190
+ await this . render ( commonTemplate ) ;
191
+
192
+ assert . ok ( this . onDataError . calledOnce ) ;
193
+ assert . deepEqual ( this . onDataError . getCall ( 0 ) . args [ 0 ] , [
194
+ {
195
+ type : 'filtered-nodes' ,
196
+ context : [ this . nodes [ 0 ] ] ,
197
+ } ,
198
+ ] ) ;
199
+
200
+ assert . equal ( TopoViz . datacenters [ 0 ] . nodes . length , 1 ) ;
201
+ } ) ;
170
202
} ) ;
0 commit comments