New N2VC interface + updated libjuju
This commit introduces the Python3 N2VC module, which acts as a standard
interface to the VCA.
The goal of this is to provide a common way for modules to interface
with the VCA.
- Updated libjuju from 0.6.1 to 0.7.3
Signed-off-by: Adam Israel <adam.israel@canonical.com>
Change-Id: Ide70fb5ae5797eb6486de24653dc09a23f9c009e
diff --git a/modules/libjuju/tests/integration/test_connection.py b/modules/libjuju/tests/integration/test_connection.py
index 290203d..79ad9d0 100644
--- a/modules/libjuju/tests/integration/test_connection.py
+++ b/modules/libjuju/tests/integration/test_connection.py
@@ -1,28 +1,19 @@
import asyncio
+
+from juju.client import client
+from juju.client.connection import Connection
+
import pytest
-from juju.client.connection import Connection
-from juju.client import client
from .. import base
@base.bootstrapped
@pytest.mark.asyncio
-async def test_connect_current(event_loop):
- async with base.CleanModel():
- conn = await Connection.connect_current()
-
- assert isinstance(conn, Connection)
- await conn.close()
-
-
-@base.bootstrapped
-@pytest.mark.asyncio
async def test_monitor(event_loop):
- async with base.CleanModel():
- conn = await Connection.connect_current()
-
+ async with base.CleanModel() as model:
+ conn = model.connection()
assert conn.monitor.status == 'connected'
await conn.close()
@@ -33,15 +24,17 @@
@pytest.mark.asyncio
async def test_monitor_catches_error(event_loop):
- async with base.CleanModel():
- conn = await Connection.connect_current()
+ async with base.CleanModel() as model:
+ conn = model.connection()
assert conn.monitor.status == 'connected'
- await conn.ws.close()
-
- assert conn.monitor.status == 'error'
-
- await conn.close()
+ try:
+ async with conn.monitor.reconnecting:
+ await conn.ws.close()
+ await asyncio.sleep(1)
+ assert conn.monitor.status == 'error'
+ finally:
+ await conn.close()
@base.bootstrapped
@@ -55,7 +48,7 @@
channel='stable',
)
- c = client.ClientFacade.from_connection(model.connection)
+ c = client.ClientFacade.from_connection(model.connection())
await c.FullStatus(None)
@@ -64,15 +57,8 @@
@pytest.mark.asyncio
async def test_reconnect(event_loop):
async with base.CleanModel() as model:
- conn = await Connection.connect(
- model.connection.endpoint,
- model.connection.uuid,
- model.connection.username,
- model.connection.password,
- model.connection.cacert,
- model.connection.macaroons,
- model.connection.loop,
- model.connection.max_frame_size)
+ kwargs = model.connection().connect_params()
+ conn = await Connection.connect(**kwargs)
try:
await asyncio.sleep(0.1)
assert conn.is_open