Relation support for multi-charm VNFs
Adds support for establishing relations between charms
Signed-off-by: Adam Israel <adam.israel@canonical.com>
Change-Id: I9a0b7725013e06635875cd824e219ab6a023efb3
diff --git a/tests/charms/layers/native-ci/layer.yaml b/tests/charms/layers/native-ci/layer.yaml
index edc8839..138d9d3 100644
--- a/tests/charms/layers/native-ci/layer.yaml
+++ b/tests/charms/layers/native-ci/layer.yaml
@@ -1,4 +1,7 @@
-includes: ['layer:basic']
+includes:
+ - 'layer:basic'
+ - 'interface:mysql'
+
options:
basic:
use_venv: false
diff --git a/tests/charms/layers/native-ci/metadata.yaml b/tests/charms/layers/native-ci/metadata.yaml
index 6acf296..0460e48 100644
--- a/tests/charms/layers/native-ci/metadata.yaml
+++ b/tests/charms/layers/native-ci/metadata.yaml
@@ -4,3 +4,9 @@
maintainer: Adam Israel <adam.israel@canonical.com>
subordinate: false
series: ['xenial']
+provides:
+ db:
+ interface: mysql
+requires:
+ app:
+ interface: mysql
diff --git a/tests/charms/layers/native-ci/reactive/native-ci.py b/tests/charms/layers/native-ci/reactive/native-ci.py
index 17bf5f4..9e5fe67 100644
--- a/tests/charms/layers/native-ci/reactive/native-ci.py
+++ b/tests/charms/layers/native-ci/reactive/native-ci.py
@@ -42,3 +42,21 @@
action_set({'output': intval})
finally:
clear_flag('actions.testint')
+
+
+@when('db.joined')
+def provides_db(db):
+ """Simulate providing database credentials."""
+ db.configure(
+ database="mydb",
+ user="myuser",
+ password="mypassword",
+ host="myhost",
+ slave="myslave",
+ )
+
+
+@when('db.available')
+def requires_db(db):
+ """Simulate receiving database credentials."""
+ pass
diff --git a/tests/charms/layers/proxy-ci/metadata.yaml b/tests/charms/layers/proxy-ci/metadata.yaml
index b96abe4..bb00a03 100644
--- a/tests/charms/layers/proxy-ci/metadata.yaml
+++ b/tests/charms/layers/proxy-ci/metadata.yaml
@@ -10,3 +10,9 @@
subordinate: false
series:
- xenial
+provides:
+ db:
+ interface: mysql
+requires:
+ app:
+ interface: mysql
diff --git a/tests/charms/layers/proxy-ci/reactive/proxy_ci.py b/tests/charms/layers/proxy-ci/reactive/proxy_ci.py
index 98b7f96..9c0136e 100644
--- a/tests/charms/layers/proxy-ci/reactive/proxy_ci.py
+++ b/tests/charms/layers/proxy-ci/reactive/proxy_ci.py
@@ -32,3 +32,21 @@
action_set({'output': result})
finally:
clear_flag('actions.test')
+
+
+@when('db.joined')
+def provides_db(db):
+ """Simulate providing database credentials."""
+ db.configure(
+ database="mydb",
+ user="myuser",
+ password="mypassword",
+ host="myhost",
+ slave="myslave",
+ )
+
+
+@when('db.available')
+def requires_db(db):
+ """Simulate receiving database credentials."""
+ pass
diff --git a/tests/integration/test_multivdu_multicharm.py b/tests/integration/test_multivdu_multicharm.py
index e0fb9c7..b879373 100644
--- a/tests/integration/test_multivdu_multicharm.py
+++ b/tests/integration/test_multivdu_multicharm.py
@@ -144,6 +144,11 @@
juju:
charm: proxy-ci
proxy: true
+ # Relation needs to map to the vdu providing or
+ # requiring, so that we can map to the deployed app.
+ relation:
+ - provides: dataVM:db
+ requires: mgmtVM:app
initial-config-primitive:
- seq: '1'
name: test