Skip to content

Commit

Permalink
tests(): reAssert message
Browse files Browse the repository at this point in the history
  • Loading branch information
merkata committed Sep 25, 2024
1 parent 873adc5 commit 0ab8013
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src-docs/charm.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Unit that this execution is responsible for.

---

<a href="../src/charm.py#L69"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/charm.py#L74"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `reconcile`

Expand Down
26 changes: 25 additions & 1 deletion src-docs/charm_types.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Returns the set of fields that have been explicitly set on this model instance.

---

<a href="../src/charm_types.py#L55"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/charm_types.py#L84"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>classmethod</kbd> `userids_to_list`

Expand Down Expand Up @@ -126,6 +126,7 @@ A named tuple representing a Datasource PostgreSQL.
- <b>`host`</b>: Host (IP or DNS without port or protocol).
- <b>`port`</b>: Port.
- <b>`db`</b>: Database name.
- <b>`uri`</b>: Database connection URI.


---
Expand All @@ -152,4 +153,27 @@ Returns the set of fields that have been explicitly set on this model instance.



---

<a href="../src/charm_types.py#L34"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>classmethod</kbd> `from_relation`

```python
from_relation(relation: Relation) → DatasourcePostgreSQL
```

Create a DatasourcePostgreSQL from a relation.



**Args:**

- <b>`relation`</b>: The relation to get the data from.



**Returns:**
A DatasourcePostgreSQL instance.


8 changes: 4 additions & 4 deletions src-docs/constants.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ File containing constants to be used in the charm.

**Global Variables**
---------------
- **IRC_BRIDGE_HEALTH_PORT**
- **IRC_BRIDGE_KEY_ALGO**
- **IRC_BRIDGE_KEY_OPTS**
- **DATABASE_NAME**
- **DATABASE_RELATION_NAME**
- **IRC_BRIDGE_SNAP_NAME**
- **IRC_BRIDGE_CONFIG_PATH**
- **IRC_BRIDGE_CONFIG_TEMPLATE_PATH**
- **IRC_BRIDGE_HEALTH_PORT**
- **MATRIX_RELATION_NAME**
- **IRC_BRIDGE_SNAP_NAME**
- **SNAP_PACKAGES**


19 changes: 15 additions & 4 deletions src-docs/database_observer.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ The Database relation observer.

- <b>`relation_name`</b>: The name of the relation to observe.
- <b>`database`</b>: The database relation interface.
- <b>`uri`</b>: The database uri.

<a href="../src/database_observer.py#L25"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/database_observer.py#L28"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `__init__`

Expand All @@ -47,12 +46,24 @@ Initialize the oserver and register event handlers.

Shortcut for more simple access the model.



---

#### <kbd>property</kbd> uri
<a href="../src/database_observer.py#L54"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `get_db`

```python
get_db() → Optional[DatasourcePostgreSQL]
```

Reconcile the database relation.
Return a postgresql datasource model.



**Returns:**

- <b>`DatasourcePostgreSQL`</b>: The datasource model.


18 changes: 8 additions & 10 deletions src-docs/irc.py.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ IRC Bridge charm business logic.

**Global Variables**
---------------
- **IRC_BRIDGE_CONFIG_PATH**
- **IRC_BRIDGE_CONFIG_TEMPLATE_PATH**
- **IRC_BRIDGE_HEALTH_PORT**
- **IRC_BRIDGE_KEY_ALGO**
- **IRC_BRIDGE_KEY_OPTS**
- **IRC_BRIDGE_SNAP_NAME**
- **SNAP_PACKAGES**

Expand All @@ -26,7 +26,7 @@ This class provides the necessary methods to manage the matrix-appservice-irc se

---

<a href="../src/irc.py#L129"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/irc.py#L130"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `configure`

Expand All @@ -50,7 +50,7 @@ Configure the service.

---

<a href="../src/irc.py#L77"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/irc.py#L84"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `prepare`

Expand All @@ -64,7 +64,7 @@ Install the snap package and create the configuration directory and file.

---

<a href="../src/irc.py#L56"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/irc.py#L65"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `reconcile`

Expand All @@ -80,8 +80,6 @@ Reconcile the service.

Simple flow:
- Check if the snap is installed
- Check if we have a database relation
- Check if we have a matrix relation
- Check if the configuration files exist
- Check if the service is running

Expand All @@ -95,7 +93,7 @@ Simple flow:

---

<a href="../src/irc.py#L199"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/irc.py#L208"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `reload`

Expand All @@ -115,7 +113,7 @@ Check if the service is running and reload it.

---

<a href="../src/irc.py#L214"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/irc.py#L223"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `start`

Expand All @@ -133,7 +131,7 @@ Start the matrix-appservice-irc service.

---

<a href="../src/irc.py#L227"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
<a href="../src/irc.py#L236"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>function</kbd> `stop`

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ async def test_lifecycle_before_relations(app: ops.model.Application, ops_test:
# Mypy has difficulty with ActiveStatus
assert unit.workload_status == ops.model.BlockedStatus.name # type: ignore
# Assert part of the message
assert "Database relation not found" in ops.model.BlockedStatus.message # type: ignore
assert ops.BlockedStatus("Database relation not found") == app.status

0 comments on commit 0ab8013

Please sign in to comment.