Skip to content

Commit

Permalink
Merge branch 'main' into jake/sub-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeDawkins authored Dec 14, 2020
2 parents f5bf095 + 47fd59b commit 4adc983
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Tests

on: [pull_request]
on: [push, pull_request]

jobs:
test:
Expand Down
19 changes: 7 additions & 12 deletions crates/rover-client/src/query/partial/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn run(
) -> Result<PushPartialSchemaResponse, RoverClientError> {
let data = client.post::<PushPartialSchemaMutation>(variables)?;
let push_response = get_push_response_from_data(data)?;
build_response(push_response)
Ok(build_response(push_response))
}

// alias this return type since it's disgusting
Expand All @@ -48,9 +48,7 @@ fn get_push_response_from_data(
Ok(service_data.upsert_implementing_service_and_trigger_composition)
}

fn build_response(
push_response: UpdateResponse,
) -> Result<PushPartialSchemaResponse, RoverClientError> {
fn build_response(push_response: UpdateResponse) -> PushPartialSchemaResponse {
let composition_errors: Vec<String> = push_response
.errors
.iter()
Expand All @@ -67,15 +65,15 @@ fn build_response(
None
};

Ok(PushPartialSchemaResponse {
PushPartialSchemaResponse {
schema_hash: match push_response.composition_config {
Some(config) => Some(config.schema_hash),
None => None,
},
did_update_gateway: push_response.did_update_gateway,
service_was_created: push_response.service_was_created,
composition_errors,
})
}
}

#[cfg(test)]
Expand All @@ -97,9 +95,8 @@ mod tests {
let update_response: UpdateResponse = serde_json::from_value(json_response).unwrap();
let output = build_response(update_response);

assert!(output.is_ok());
assert_eq!(
output.unwrap(),
output,
PushPartialSchemaResponse {
schema_hash: Some("5gf564".to_string()),
composition_errors: Some(vec![
Expand All @@ -123,9 +120,8 @@ mod tests {
let update_response: UpdateResponse = serde_json::from_value(json_response).unwrap();
let output = build_response(update_response);

assert!(output.is_ok());
assert_eq!(
output.unwrap(),
output,
PushPartialSchemaResponse {
schema_hash: Some("5gf564".to_string()),
composition_errors: None,
Expand All @@ -148,9 +144,8 @@ mod tests {
let update_response: UpdateResponse = serde_json::from_value(json_response).unwrap();
let output = build_response(update_response);

assert!(output.is_ok());
assert_eq!(
output.unwrap(),
output,
PushPartialSchemaResponse {
schema_hash: None,
composition_errors: Some(
Expand Down
10 changes: 4 additions & 6 deletions src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ fn get_command_from_args(mut raw_arguments: &mut serde_json::Value) -> Command {
should_break = false;
}

if let Some(leftover_arguments) = leftover_arguments {
if let serde_json::Value::Object(object) = leftover_arguments {
for argument in object.iter() {
let (key, value) = argument;
arguments.insert(key.to_lowercase(), value.to_owned());
}
if let Some(serde_json::Value::Object(object)) = leftover_arguments {
for argument in object.iter() {
let (key, value) = argument;
arguments.insert(key.to_lowercase(), value.to_owned());
}
}

Expand Down

0 comments on commit 4adc983

Please sign in to comment.