Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
all test files pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Makoto-Tomokiyo committed Apr 30, 2024
1 parent b0e5cef commit fa45e8d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/bin/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ mod tests {
// use scheduler2::parser::ExecutionPlanParser;
// use crate::{file_mode, run_single_query, start_system, CATALOG_PATH, TPCH_FILES};
use crate::TPCH_FILES;
use crate::file_mode;

#[tokio::test]
async fn test_file_mode() {
Expand Down
5 changes: 3 additions & 2 deletions src/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct IntegrationTest {
}

const CONFIG_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/executors.toml");
const CATALOG_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/test_data");
pub const CATALOG_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/test_data");
const LOG_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/executor_logs");

impl IntegrationTest {
Expand Down Expand Up @@ -195,7 +195,8 @@ impl IntegrationTest {
mod tests {
use crate::integration_test::IntegrationTest;
use crate::parser::ExecutionPlanParser;
use crate::CATALOG_PATH;
// use crate::CATALOG_PATH;
use super::*;
use datafusion::arrow::array::{Int32Array, RecordBatch};
use datafusion::arrow::datatypes::{DataType, Field, Schema};
use std::path::PathBuf;
Expand Down
4 changes: 2 additions & 2 deletions src/intermediate_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ pub async fn rewrite_query(
mod tests {
use super::*;
use crate::parser::ExecutionPlanParser;
use crate::CATALOG_PATH;
use datafusion::arrow::array::{Array, Int32Array};
use crate::integration_test::CATALOG_PATH;
use datafusion::arrow::array::Int32Array;
use datafusion::arrow::datatypes::{DataType, Field, Schema};
use datafusion::arrow::record_batch::RecordBatch;

Expand Down
20 changes: 17 additions & 3 deletions src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ impl Queue {
mod tests {
use rand::Rng;
use tokio::sync::{Mutex, Notify};
use tokio::time::sleep;
use std::time::Duration;

use crate::parser::ExecutionPlanParser;
use crate::{
Expand All @@ -203,18 +205,30 @@ mod tests {
time::SystemTime,
};

// Test that query keys compare properly.
#[tokio::test]
async fn test_query_key_cmp() {
let then = SystemTime::now();
let now1 = SystemTime::now().duration_since(then).unwrap();
sleep(Duration::from_secs(1)).await;
let now2 = SystemTime::now().duration_since(then).unwrap();

let key1 = QueryKey {
ft: SystemTime::now().duration_since(then).unwrap(),
qid: 0,
ft: now1.clone(),
qid: 1,
};
let key2 = QueryKey {
ft: SystemTime::now().duration_since(then).unwrap(),
ft: now2,
qid: 0,
};
let key3 = QueryKey {
ft: now1,
qid: 0,
};
// Make sure durations are compared first
assert!(key1 < key2);
// Then qids
assert!(key3 < key1);
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion src/task_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl TaskQueue {
#[cfg(test)]
mod tests {
use super::*;
use crate::server::composable_database::TaskId;
use crate::composable_database::TaskId;
use crate::task::TaskStatus;
use std::sync::Arc;
use tokio::runtime::Runtime;
Expand Down

0 comments on commit fa45e8d

Please sign in to comment.