-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
smoketests: use compose file for docker restart
- Loading branch information
1 parent
7c39d87
commit 637d310
Showing
4 changed files
with
57 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import time | ||
from .. import Smoketest, run_cmd, requires_docker | ||
from .zz_docker import restart_docker, kill_node | ||
#@requires_docker | ||
class ReplicationTest(Smoketest): | ||
MODULE_CODE = """ | ||
use spacetimedb::{ReducerContext, Table}; | ||
#[spacetimedb::table(name = message, public)] | ||
pub struct Message { | ||
#[primary_key] | ||
#[auto_inc] | ||
id: u64, | ||
text: String, | ||
} | ||
#[spacetimedb::reducer] | ||
fn send_message(ctx: &ReducerContext, text: String) { | ||
ctx.db.message().insert(Message {id:0, text}); | ||
} | ||
""" | ||
def test_leader_failure(self): | ||
"""This test deploys a module with a scheduled reducer and check if client receives subscription update for scheduled table entry and deletion of reducer once it ran""" | ||
print("hey") | ||
# subscribe to empy scheduled_table | ||
sub = self.subscribe("SELECT * FROM message", n=2) | ||
|
||
time.sleep(1) | ||
for i in range(1,2): # Iterating from 1 to 100 | ||
self.call("send_message", i) | ||
|
||
|
||
leader = self.leader_node(); | ||
print("leader", leader); | ||
kill_node(leader) | ||
restart_docker() | ||
|
||
time.sleep(1) | ||
for i in range(5, 6): # Iterating from 1 to 100 | ||
self.call("send_message", i) | ||
|
||
|
||
leader = self.leader_node(); | ||
print("leader", leader); | ||
# print(sub()) | ||
exit(1) | ||
|
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