Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/setup-java-4
Browse files Browse the repository at this point in the history
  • Loading branch information
minikin authored Dec 15, 2023
2 parents 9a0eaa7 + 02b9552 commit be4c063
Show file tree
Hide file tree
Showing 24 changed files with 0 additions and 3,412 deletions.
26 changes: 0 additions & 26 deletions catalyst-gateway/bin/src/event_db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,3 @@ pub(crate) async fn establish_connection(

Ok(db)
}

// Need to setup and run a test event db instance
// To do it you can use the following commands:
// Prepare docker images
// ```
// earthly ./containers/event-db-migrations+docker --data=test
// ```
// Run event-db container
// ```
// docker-compose -f src/event-db/docker-compose.yml up migrations
// ```
// Also need establish `EVENT_DB_URL` env variable with the following value
// ```
// EVENT_DB_URL = "postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev"
// ```
// [readme](https://github.com/input-output-hk/catalyst-core/tree/main/src/event-db/Readme.md)
// #[cfg(test)]
// mod test {
// use super::*;
//
// Check if the schema version in the DB is up to date.
// #[tokio::test]
// async fn check_schema_version() {
// establish_connection(None).await.unwrap();
// }
// }
188 changes: 0 additions & 188 deletions catalyst-gateway/bin/src/event_db/queries/event/ballot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,191 +210,3 @@ impl BallotQueries for EventDB {
.collect())
}
}

/// Need to setup and run a test event db instance
/// To do it you can use the following commands:
/// Prepare docker images
/// ```
/// earthly ./containers/event-db-migrations+docker --data=test
/// ```
/// Run event-db container
/// ```
/// docker-compose -f src/event-db/docker-compose.yml up migrations
/// ```
/// Also need establish `EVENT_DB_URL` env variable with the following value
/// ```
/// EVENT_DB_URL = "postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev"
/// ```
/// [readme](https://github.com/input-output-hk/catalyst-core/tree/main/src/event-db/Readme.md)
#[cfg(test)]
mod tests {
// use super::*;
// use crate::event_db::establish_connection;
//
// #[tokio::test]
// async fn get_ballot_test() {
// let event_db = establish_connection(None).await.unwrap();
//
// let ballot = event_db
// .get_ballot(EventId(1), ObjectiveId(1), ProposalId(10))
// .await
// .unwrap();
//
// assert_eq!(
// Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 10,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 12,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// ballot,
// );
// }
//
// #[tokio::test]
// async fn get_objective_ballots_test() {
// let event_db = establish_connection(None).await.unwrap();
//
// let ballots = event_db
// .get_objective_ballots(EventId(1), ObjectiveId(1))
// .await
// .unwrap();
//
// assert_eq!(
// vec![
// ProposalBallot {
// proposal_id: ProposalId(10),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 10,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 12,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// },
// ProposalBallot {
// proposal_id: ProposalId(20),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 11,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 13,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// },
// ProposalBallot {
// proposal_id: ProposalId(30),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![]),
// },
// }
// ],
// ballots,
// );
// }
//
// #[tokio::test]
// async fn get_event_ballots_test() {
// let event_db = establish_connection(None).await.unwrap();
//
// let ballots = event_db.get_event_ballots(EventId(1)).await.unwrap();
//
// assert_eq!(
// vec![ObjectiveBallots {
// objective_id: ObjectiveId(1),
// ballots: vec![
// ProposalBallot {
// proposal_id: ProposalId(10),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 10,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 12,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// },
// ProposalBallot {
// proposal_id: ProposalId(20),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 11,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 13,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// },
// ProposalBallot {
// proposal_id: ProposalId(30),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![]),
// },
// }
// ]
// }],
// ballots
// );
// }
}
Loading

0 comments on commit be4c063

Please sign in to comment.