fix: ReceiveRepoConfig tries to send two messages
Similar to CloneRepo the handler tries to send two messages one after the other. Leave it to WebhookRegistered handler to kick off the ValidateRepo. Also update the README with the correct message sequence.
This commit is contained in:
parent
68005d757d
commit
c9efbb9936
3 changed files with 0 additions and 37 deletions
|
@ -3,7 +3,6 @@ stateDiagram-v2
|
||||||
[*] --> CloneRepo :on start
|
[*] --> CloneRepo :on start
|
||||||
|
|
||||||
CloneRepo --> LoadConfigFromRepo :on repo config
|
CloneRepo --> LoadConfigFromRepo :on repo config
|
||||||
CloneRepo --> ValidateRepo :on server config
|
|
||||||
CloneRepo --> RegisterWebhook :on server config
|
CloneRepo --> RegisterWebhook :on server config
|
||||||
|
|
||||||
LoadConfigFromRepo --> ReceiveRepoConfig
|
LoadConfigFromRepo --> ReceiveRepoConfig
|
||||||
|
|
|
@ -14,12 +14,6 @@ impl Handler<actor::messages::ReceiveRepoConfig> for actor::RepoActor {
|
||||||
let repo_config = msg.unwrap();
|
let repo_config = msg.unwrap();
|
||||||
self.repo_details.repo_config.replace(repo_config);
|
self.repo_details.repo_config.replace(repo_config);
|
||||||
|
|
||||||
actor::do_send(
|
|
||||||
ctx.address(),
|
|
||||||
actor::messages::ValidateRepo::new(self.message_token),
|
|
||||||
&self.log,
|
|
||||||
);
|
|
||||||
|
|
||||||
actor::do_send(
|
actor::do_send(
|
||||||
ctx.address(),
|
ctx.address(),
|
||||||
actor::messages::RegisterWebhook::new(),
|
actor::messages::RegisterWebhook::new(),
|
||||||
|
|
|
@ -32,36 +32,6 @@ async fn should_store_repo_config_in_actor() -> TestResult {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix::test]
|
|
||||||
async fn should_validate_repo() -> TestResult {
|
|
||||||
//given
|
|
||||||
let fs = given::a_filesystem();
|
|
||||||
let (open_repository, repo_details) = given::an_open_repository(&fs);
|
|
||||||
|
|
||||||
let new_repo_config = given::a_repo_config();
|
|
||||||
|
|
||||||
//when
|
|
||||||
let (addr, log) = when::start_actor_with_open_repository(
|
|
||||||
Box::new(open_repository),
|
|
||||||
repo_details,
|
|
||||||
given::a_forge(),
|
|
||||||
);
|
|
||||||
addr.send(actor::messages::ReceiveRepoConfig::new(
|
|
||||||
new_repo_config.clone(),
|
|
||||||
))
|
|
||||||
.await?;
|
|
||||||
System::current().stop();
|
|
||||||
|
|
||||||
//then
|
|
||||||
tracing::debug!(?log, "");
|
|
||||||
log.read().map_err(|e| e.to_string()).map(|l| {
|
|
||||||
assert!(l
|
|
||||||
.iter()
|
|
||||||
.any(|message| message.contains("send: ValidateRepo")))
|
|
||||||
})?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[actix::test]
|
#[actix::test]
|
||||||
async fn should_register_webhook() -> TestResult {
|
async fn should_register_webhook() -> TestResult {
|
||||||
//given
|
//given
|
||||||
|
|
Loading…
Reference in a new issue