deb-murano/meta/io.murano/Classes/test/TestFixture.yaml
Stan Lagun 2f2132350d TestFixture mocks were updated
Core library was updated as part of the multi-region support
effort. FormatVersion of the core library was incremented and,
as a result $dict.key expressions started to work as they are in
yaql 1.0 rather than in 0.2 and the presence of the key become
mandatory. However Network mock in the TextFixture used to
return empty dictionary and it caused Instance class to fail.
The commit adds missing keys to the dictionary returned by
the joinInstance() method.

Also the test runner was improved to print the stack trace
upon failures so that it is possible to identify where the
error happened.

Change-Id: Ia7b0f61370effe4f13fed4ec85e806f3b0fdb80b
2016-08-29 10:05:49 -07:00

84 lines
2.1 KiB
YAML

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
Namespaces:
=: io.murano.test
std: io.murano
sys: io.murano.system
res: io.murano.resources
--- # ------------------------------------------------------------------ # ---
Name: TestFixture
Methods:
setUp:
Body:
tearDown:
Body:
--- # ------------------------------------------------------------------ # ---
Name: DummyNetwork
Extends: res:Network
Methods:
joinInstance:
Arguments:
- instance:
Contract: $.class(res:Instance).notNull()
- securityGroupName:
Contract: $.string()
- assignFloatingIp:
Contract: $.bool().notNull()
- sharedIps:
Contract:
- $.class(std:SharedIp)
Body:
- Return:
template: {}
portRef:
instanceFipOutput:
generateSecurityGroupManager:
Body:
- Return: new(sys:DummySecurityGroupManager, $this)
describe:
Body:
- Return: {}
--- # ------------------------------------------------------------------ # ---
Name: TestFixtureWithEnvironment
Extends: TestFixture
Properties:
environment:
Usage: Runtime
Contract: $.class(std:Environment)
Methods:
setUp:
Body:
- $testClassName: typeinfo($).name
- $envName: format('environment-of-testclass-{0}', $testClassName)
- $netName: format('default-network-of-testclass-{0}', $testClassName)
- $envSnippet:
Objects:
std:Environment:
name: $envName
defaultNetworks:
environment:
:DummyNetwork:
- $this.environment: $this.load($envSnippet)