Skip to content

Commit 02b9552

Browse files
authored
feat: Cleanup staled tests from catalyst-gateway (#187)
* remove unneeded tests * remove unneeded event-db test data
1 parent 79869df commit 02b9552

24 files changed

+0
-3412
lines changed

catalyst-gateway/bin/src/event_db/mod.rs

-26
Original file line numberDiff line numberDiff line change
@@ -79,29 +79,3 @@ pub(crate) async fn establish_connection(
7979

8080
Ok(db)
8181
}
82-
83-
// Need to setup and run a test event db instance
84-
// To do it you can use the following commands:
85-
// Prepare docker images
86-
// ```
87-
// earthly ./containers/event-db-migrations+docker --data=test
88-
// ```
89-
// Run event-db container
90-
// ```
91-
// docker-compose -f src/event-db/docker-compose.yml up migrations
92-
// ```
93-
// Also need establish `EVENT_DB_URL` env variable with the following value
94-
// ```
95-
// EVENT_DB_URL = "postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev"
96-
// ```
97-
// [readme](https://github.com/input-output-hk/catalyst-core/tree/main/src/event-db/Readme.md)
98-
// #[cfg(test)]
99-
// mod test {
100-
// use super::*;
101-
//
102-
// Check if the schema version in the DB is up to date.
103-
// #[tokio::test]
104-
// async fn check_schema_version() {
105-
// establish_connection(None).await.unwrap();
106-
// }
107-
// }

catalyst-gateway/bin/src/event_db/queries/event/ballot.rs

-188
Original file line numberDiff line numberDiff line change
@@ -210,191 +210,3 @@ impl BallotQueries for EventDB {
210210
.collect())
211211
}
212212
}
213-
214-
/// Need to setup and run a test event db instance
215-
/// To do it you can use the following commands:
216-
/// Prepare docker images
217-
/// ```
218-
/// earthly ./containers/event-db-migrations+docker --data=test
219-
/// ```
220-
/// Run event-db container
221-
/// ```
222-
/// docker-compose -f src/event-db/docker-compose.yml up migrations
223-
/// ```
224-
/// Also need establish `EVENT_DB_URL` env variable with the following value
225-
/// ```
226-
/// EVENT_DB_URL = "postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev"
227-
/// ```
228-
/// [readme](https://github.com/input-output-hk/catalyst-core/tree/main/src/event-db/Readme.md)
229-
#[cfg(test)]
230-
mod tests {
231-
// use super::*;
232-
// use crate::event_db::establish_connection;
233-
//
234-
// #[tokio::test]
235-
// async fn get_ballot_test() {
236-
// let event_db = establish_connection(None).await.unwrap();
237-
//
238-
// let ballot = event_db
239-
// .get_ballot(EventId(1), ObjectiveId(1), ProposalId(10))
240-
// .await
241-
// .unwrap();
242-
//
243-
// assert_eq!(
244-
// Ballot {
245-
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
246-
// voteplans: GroupVotePlans(vec![
247-
// VotePlan {
248-
// chain_proposal_index: 10,
249-
// group: Some(VoterGroupId("direct".to_string())),
250-
// ballot_type: BallotType("public".to_string()),
251-
// chain_voteplan_id: "1".to_string(),
252-
// encryption_key: None,
253-
// },
254-
// VotePlan {
255-
// chain_proposal_index: 12,
256-
// group: Some(VoterGroupId("rep".to_string())),
257-
// ballot_type: BallotType("public".to_string()),
258-
// chain_voteplan_id: "2".to_string(),
259-
// encryption_key: None,
260-
// }
261-
// ]),
262-
// },
263-
// ballot,
264-
// );
265-
// }
266-
//
267-
// #[tokio::test]
268-
// async fn get_objective_ballots_test() {
269-
// let event_db = establish_connection(None).await.unwrap();
270-
//
271-
// let ballots = event_db
272-
// .get_objective_ballots(EventId(1), ObjectiveId(1))
273-
// .await
274-
// .unwrap();
275-
//
276-
// assert_eq!(
277-
// vec![
278-
// ProposalBallot {
279-
// proposal_id: ProposalId(10),
280-
// ballot: Ballot {
281-
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
282-
// voteplans: GroupVotePlans(vec![
283-
// VotePlan {
284-
// chain_proposal_index: 10,
285-
// group: Some(VoterGroupId("direct".to_string())),
286-
// ballot_type: BallotType("public".to_string()),
287-
// chain_voteplan_id: "1".to_string(),
288-
// encryption_key: None,
289-
// },
290-
// VotePlan {
291-
// chain_proposal_index: 12,
292-
// group: Some(VoterGroupId("rep".to_string())),
293-
// ballot_type: BallotType("public".to_string()),
294-
// chain_voteplan_id: "2".to_string(),
295-
// encryption_key: None,
296-
// }
297-
// ]),
298-
// },
299-
// },
300-
// ProposalBallot {
301-
// proposal_id: ProposalId(20),
302-
// ballot: Ballot {
303-
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
304-
// voteplans: GroupVotePlans(vec![
305-
// VotePlan {
306-
// chain_proposal_index: 11,
307-
// group: Some(VoterGroupId("direct".to_string())),
308-
// ballot_type: BallotType("public".to_string()),
309-
// chain_voteplan_id: "1".to_string(),
310-
// encryption_key: None,
311-
// },
312-
// VotePlan {
313-
// chain_proposal_index: 13,
314-
// group: Some(VoterGroupId("rep".to_string())),
315-
// ballot_type: BallotType("public".to_string()),
316-
// chain_voteplan_id: "2".to_string(),
317-
// encryption_key: None,
318-
// }
319-
// ]),
320-
// },
321-
// },
322-
// ProposalBallot {
323-
// proposal_id: ProposalId(30),
324-
// ballot: Ballot {
325-
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
326-
// voteplans: GroupVotePlans(vec![]),
327-
// },
328-
// }
329-
// ],
330-
// ballots,
331-
// );
332-
// }
333-
//
334-
// #[tokio::test]
335-
// async fn get_event_ballots_test() {
336-
// let event_db = establish_connection(None).await.unwrap();
337-
//
338-
// let ballots = event_db.get_event_ballots(EventId(1)).await.unwrap();
339-
//
340-
// assert_eq!(
341-
// vec![ObjectiveBallots {
342-
// objective_id: ObjectiveId(1),
343-
// ballots: vec![
344-
// ProposalBallot {
345-
// proposal_id: ProposalId(10),
346-
// ballot: Ballot {
347-
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
348-
// voteplans: GroupVotePlans(vec![
349-
// VotePlan {
350-
// chain_proposal_index: 10,
351-
// group: Some(VoterGroupId("direct".to_string())),
352-
// ballot_type: BallotType("public".to_string()),
353-
// chain_voteplan_id: "1".to_string(),
354-
// encryption_key: None,
355-
// },
356-
// VotePlan {
357-
// chain_proposal_index: 12,
358-
// group: Some(VoterGroupId("rep".to_string())),
359-
// ballot_type: BallotType("public".to_string()),
360-
// chain_voteplan_id: "2".to_string(),
361-
// encryption_key: None,
362-
// }
363-
// ]),
364-
// },
365-
// },
366-
// ProposalBallot {
367-
// proposal_id: ProposalId(20),
368-
// ballot: Ballot {
369-
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
370-
// voteplans: GroupVotePlans(vec![
371-
// VotePlan {
372-
// chain_proposal_index: 11,
373-
// group: Some(VoterGroupId("direct".to_string())),
374-
// ballot_type: BallotType("public".to_string()),
375-
// chain_voteplan_id: "1".to_string(),
376-
// encryption_key: None,
377-
// },
378-
// VotePlan {
379-
// chain_proposal_index: 13,
380-
// group: Some(VoterGroupId("rep".to_string())),
381-
// ballot_type: BallotType("public".to_string()),
382-
// chain_voteplan_id: "2".to_string(),
383-
// encryption_key: None,
384-
// }
385-
// ]),
386-
// },
387-
// },
388-
// ProposalBallot {
389-
// proposal_id: ProposalId(30),
390-
// ballot: Ballot {
391-
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
392-
// voteplans: GroupVotePlans(vec![]),
393-
// },
394-
// }
395-
// ]
396-
// }],
397-
// ballots
398-
// );
399-
// }
400-
}

0 commit comments

Comments
 (0)