Exemple #1
0
 def test_illegal_instance_key_field_type(self):
     check = TopologyCheck()
     check.key = TopologyInstance("mytype", 1)
     with pytest.raises(ValueError) as e:
         assert check.component("my-id", "my-type", None)
     assert str(
         e.value) == "Instance requires a 'url' field of type 'string'"
Exemple #2
0
    def __init__(self, include_instance_config):
        instance = {
            'identifier_mappings': {
                'host': {
                    'field': 'url',
                    'prefix': 'urn:computer:/'
                },
                'vm': {
                    'field': 'name',
                    'prefix': 'urn:computer:/'
                }
            },
        }

        if include_instance_config:
            instance.update({
                'stackstate-layer':
                'instance-stackstate-layer',
                'stackstate-environment':
                'instance-stackstate-environment',
                'stackstate-domain':
                'instance-stackstate-domain',
                'stackstate-identifier':
                'instance-stackstate-identifier',
                'stackstate-identifiers':
                'urn:process:/mapped-identifier:0:1234567890, \
                    urn:process:/mapped-identifier:1:1234567890 \
                    urn:process:/mapped-identifier:2:1234567890  ,  \
                    urn:process:/mapped-identifier:3:1234567890'
            })

        super(TagsAndConfigMappingAgentCheck, self) \
            .__init__(TopologyInstance("host", "someurl"), "test", {}, [instance])
Exemple #3
0
 def __init__(self):
     instances = [{
         'identifier_mappings': {
             'host': {
                 'field': 'x.y.z.url',
                 'prefix': 'urn:computer:/'
             }
         }
     }]
     super(NestedIdentifierMappingTestAgentCheck, self)\
         .__init__(TopologyInstance("host", "someurl"), "test", {}, instances)
Exemple #4
0
 def test_topology_instance(self, topology):
     check = TopologyCheck()
     check.key = TopologyInstance("mytype", "myurl")
     assert check._get_instance_key_dict() == {
         "type": "mytype",
         "url": "myurl"
     }
     check.create_integration_instance()
     # assert integration topology is created for topology instances
     topo_instances = topology.get_snapshot('mytype:myurl')
     assert topo_instances == self.agent_integration_topology(
         'mytype', 'myurl')
Exemple #5
0
 def __init__(self):
     instances = [{'a': 'b'}]
     super(TopologyAutoSnapshotCheck, self) \
         .__init__(TopologyInstance("mytype", "https://some.type.url", with_snapshots=True), "test", {}, instances)
Exemple #6
0
 def __init__(self, key=None, *args, **kwargs):
     super(TopologyCheck, self).__init__(*args, **kwargs)
     self.key = key or TopologyInstance("mytype", "someurl")
 def __init__(self, key=None):
     super(TopologyCheck, self).__init__()
     self.key = key or TopologyInstance("mytype", "someurl")
 def __init__(self):
     instances = [{"state_location": "./test_data_2"}]
     super(TopologyAutoSnapshotCheck, self) \
         .__init__(TopologyInstance("mytype", "https://some.type.url", with_snapshots=True), "test", {}, instances)
Exemple #9
0
 def get_instance_key(self, instance):
     return TopologyInstance(self.INSTANCE_TYPE, self.account_id)