Example #1
0
    def test_update_entity_state(self):
        # create instance event with host neighbor and check validity
        prop = {'status': 'STARTING'}
        (vertex, neighbors, processor) =\
            self._create_and_check_entity(properties=prop)

        # check added entity
        vertex = processor.entity_graph.get_vertex(vertex.vertex_id)
        self.assertEqual('STARTING', vertex.properties[VertexProperties.STATE])

        # update instance event with state running
        vertex.properties[VertexProperties.STATE] = 'RUNNING'
        vertex.properties[VertexProperties.UPDATE_TIMESTAMP] = str(utcnow())
        processor.update_entity(vertex, neighbors)

        # check state
        self._check_graph(processor, self.NUM_VERTICES_AFTER_CREATION,
                          self.NUM_EDGES_AFTER_CREATION)
        vertex = processor.entity_graph.get_vertex(vertex.vertex_id)
        self.assertEqual('RUNNING', vertex.properties[VertexProperties.STATE])
Example #2
0
 def mark_edge_as_deleted(self, edge):
     """Marks the edge as is deleted, and updates delete timestamp"""
     # TODO(Alexey): change the update_edge so it will raise a trigger
     edge[EProps.IS_DELETED] = True
     edge[EProps.UPDATE_TIMESTAMP] = str(utcnow())
     self.update_edge(edge)
 def _add_sampling_time(entity):
     entity['sample_date'] = str(utils.utcnow())
     return entity
Example #4
0
 def mark_vertex_as_deleted(self, vertex):
     """Marks the vertex as is deleted, and updates deletion timestamp"""
     # TODO(Alexey): change the update_vertex so it will raise a trigger
     vertex[VProps.IS_DELETED] = True
     vertex[VProps.UPDATE_TIMESTAMP] = str(utcnow())
     self.update_vertex(vertex)