-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from canonical/start-mongos-daemon
[DPE-2992] Start mongos daemon with provided config server
- Loading branch information
Showing
7 changed files
with
298 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from charms.mongodb.v1.helpers import MONGO_SHELL | ||
from pytest_operator.plugin import OpsTest | ||
import ops | ||
|
||
MONGOS_URI = ( | ||
"mongodb://%2Fvar%2Fsnap%2Fcharmed-mongodb%2Fcommon%2Fvar%2Fmongodb-27018.sock" | ||
) | ||
MONGOS_APP_NAME = "mongos" | ||
|
||
|
||
async def generate_mongos_command(ops_test: OpsTest) -> str: | ||
"""Generates a command which verifies mongos is running.""" | ||
return f"{MONGO_SHELL} '{MONGOS_URI}' --eval 'ping'" | ||
|
||
|
||
async def check_mongos(ops_test: OpsTest, unit: ops.model.Unit) -> bool: | ||
"""Returns whether mongos is running on the provided unit.""" | ||
mongos_check = await generate_mongos_command(ops_test) | ||
check_tls_cmd = f"exec --unit {unit.name} -- {mongos_check}" | ||
return_code, _, _ = await ops_test.juju(*check_tls_cmd.split()) | ||
return return_code == 0 |
Oops, something went wrong.