Skip to content

Commit

Permalink
smoketest checks for expected output
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Feb 22, 2018
1 parent bb4fcb6 commit af358d9
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Cargo.lock

# test output
_*.csv
_*.txt
13 changes: 12 additions & 1 deletion scripts/smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,15 @@ docker run \
-v`pwd`/test/data:/test/data \
-it datafusionrs/console:latest \
--etcd http:https://127.0.0.1:2379 \
--script /test/data/smoketest.sql
--script /test/data/smoketest.sql \
> _smoketest.txt


# did we get the expected results?
grep -v seconds _smoketest.txt > _a.txt
grep -v seconds test/data/smoketest-expected.txt > _b.txt
diff -b _a.txt _b.txt

# clean up
rm -f _*.txt 2>/dev/null
rm -f _*.csv 2>/dev/null
2 changes: 1 addition & 1 deletion src/bin/worker/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl Service for Worker {
Box::new(req.body().concat2()
.and_then(move |body| {
let json = str::from_utf8(&body).unwrap();
println!("{}", json);
//println!("{}", json);

println!("Received request");
//println!("Request: {}", json_str);
Expand Down
6 changes: 1 addition & 5 deletions src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ impl ExecutionContext {
}

fn execute_local(&self, physical_plan: &PhysicalPlan, data_dir: String) -> Result<ExecutionResult, ExecutionError> {
println!("Executing query in-process");
match physical_plan {
&PhysicalPlan::Interactive { .. } => {
Err(ExecutionError::Custom(format!("not implemented")))
Expand Down Expand Up @@ -608,7 +607,6 @@ impl ExecutionContext {
}

fn execute_remote(&self, physical_plan: &PhysicalPlan, etcd: String) -> Result<ExecutionResult, ExecutionError> {
println!("Executing query remotely");
let workers = get_worker_list(&etcd);

match workers {
Expand All @@ -617,8 +615,6 @@ impl ExecutionContext {
match worker_uri.parse() {
Ok(uri) => {

println!("Sending query to worker at {}", uri);

let mut core = Core::new().unwrap();
let client = Client::new(&core.handle());

Expand All @@ -639,7 +635,7 @@ impl ExecutionContext {
Ok(result) => {
//TODO: parse result
let result = str::from_utf8(&result).unwrap();
println!("Remote worker returned: {}", result);
println!("{}", result);
Ok(ExecutionResult::Unit)
}
Err(e) => Err(ExecutionError::Custom(format!("error: {}", e)))
Expand Down
119 changes: 119 additions & 0 deletions test/data/smoketest-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
DataFusion Console
Executing query ...
Registered schema with execution context
Executing query ...
50.376289,-4.143841
50.614429,-2.457621
50.720806,-1.904755
50.768036,0.290472
50.825024,-0.383835
50.854259,0.573453
50.967941,0.085831
51.068787,-1.794472
51.441883,0.370759
51.458057,-2.116074
51.481583,-3.17909
51.509865,-0.118092
51.568535,-1.772232
51.572376,0.470009
51.621441,-3.943646
51.752022,-1.257677
51.772938,0.10231
52.080875,0.444517
52.136436,-0.460739
52.240479,-0.902656
52.328415,-1.377561
52.370876,-1.265032
52.412811,-1.778197
52.570385,-1.824042
52.59137,-2.110748
53.002666,-2.179404
53.235046,-1.421629
53.52282,-1.128462
53.765762,-2.692337
53.801277,-1.548567
54.328506,-2.74387
54.607868,-5.926437
55.006763,-7.318268
55.458565,-4.629179
57.149651,-2.099075
57.477772,-4.224721

Executing query ...
57.477772,-4.224721
57.149651,-2.099075
55.458565,-4.629179
55.006763,-7.318268
54.607868,-5.926437
54.328506,-2.74387
53.801277,-1.548567
53.765762,-2.692337
53.52282,-1.128462
53.235046,-1.421629
53.002666,-2.179404
52.59137,-2.110748
52.570385,-1.824042
52.412811,-1.778197
52.370876,-1.265032
52.328415,-1.377561
52.240479,-0.902656
52.136436,-0.460739
52.080875,0.444517
51.772938,0.10231
51.752022,-1.257677
51.621441,-3.943646
51.572376,0.470009
51.568535,-1.772232
51.509865,-0.118092
51.481583,-3.17909
51.458057,-2.116074
51.441883,0.370759
51.068787,-1.794472
50.967941,0.085831
50.854259,0.573453
50.825024,-0.383835
50.768036,0.290472
50.720806,-1.904755
50.614429,-2.457621
50.376289,-4.143841

Executing query ...
POINT (52.412811 -1.778197)
POINT (51.481583 -3.17909)
POINT (50.768036 0.290472)
POINT (51.752022 -1.257677)
POINT (51.509865 -0.118092)
POINT (51.568535 -1.772232)
POINT (51.441883 0.370759)
POINT (52.240479 -0.902656)
POINT (52.370876 -1.265032)
POINT (52.570385 -1.824042)
POINT (51.772938 0.10231)
POINT (51.621441 -3.943646)
POINT (51.068787 -1.794472)
POINT (50.614429 -2.457621)
POINT (52.59137 -2.110748)
POINT (50.720806 -1.904755)
POINT (50.854259 0.573453)
POINT (52.136436 -0.460739)
POINT (51.572376 0.470009)
POINT (51.458057 -2.116074)
POINT (50.967941 0.085831)
POINT (50.825024 -0.383835)
POINT (50.376289 -4.143841)
POINT (52.080875 0.444517)
POINT (52.328415 -1.377561)

Executing query ...
POINT (53.002666 -2.179404)
POINT (57.149651 -2.099075)
POINT (53.235046 -1.421629)
POINT (55.006763 -7.318268)
POINT (53.765762 -2.692337)
POINT (53.52282 -1.128462)
POINT (55.458565 -4.629179)
POINT (54.607868 -5.926437)
POINT (53.801277 -1.548567)
POINT (54.328506 -2.74387)
POINT (57.477772 -4.224721)

0 comments on commit af358d9

Please sign in to comment.