Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/mvp-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: MVP CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

concurrency:
group: mvp-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
backend:
name: MVP backend
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout ASAPQuery-backend
uses: actions/checkout@v4
with:
path: ASAPQuery-backend

- name: Checkout ASAPCollector dependency
uses: actions/checkout@v4
with:
repository: ProjectASAP/ASAPCollector
path: ASAPCollector
token: ${{ secrets.ASAP_CI_REPO_TOKEN }}

- name: Checkout asap_sketchlib dependency
uses: actions/checkout@v4
with:
repository: ProjectASAP/asap_sketchlib
path: asap_sketchlib

- name: Install Rust components
run: rustup component add rustfmt clippy

- name: Install protobuf compiler
run: sudo apt-get update && sudo apt-get install --yes protobuf-compiler

- name: Configure private Cargo dependencies
env:
ASAP_CI_REPO_TOKEN: ${{ secrets.ASAP_CI_REPO_TOKEN }}
run: git config --global url."https://x-access-token:${ASAP_CI_REPO_TOKEN}@github.com/".insteadOf "https://github.com/"

- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: ASAPQuery-backend

- name: Check formatting
working-directory: ASAPQuery-backend
run: cargo fmt -p control_plane -p data_plane -- --check

- name: Check control plane and data plane
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
working-directory: ASAPQuery-backend
run: cargo check -p control_plane -p data_plane

- name: Lint control plane and data plane
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
working-directory: ASAPQuery-backend
run: cargo clippy -p control_plane -p data_plane --all-targets

- name: Test MVP control plane
env:
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
working-directory: ASAPQuery-backend
run: cargo test -p control_plane
4 changes: 2 additions & 2 deletions data_plane/src/query_engines/thanos_query_engine/forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,15 +1050,15 @@ mod tests {
#[test]
fn parse_vector_extracts_value_and_timestamp() {
let raw: Value = serde_json::from_str(
r#"[{"metric":{"__name__":"x","job":"a"},"value":[1700000000.5,"3.14"]}]"#,
r#"[{"metric":{"__name__":"x","job":"a"},"value":[1700000000.5,"3.125"]}]"#,
)
.unwrap();
let arr = raw.as_array().unwrap().clone();
let result = parse_vector(&arr).expect("parse");
match result {
QueryResult::Vector(iv) => {
assert_eq!(iv.values.len(), 1);
assert!((iv.values[0].value - 3.14).abs() < 1e-9);
assert!((iv.values[0].value - 3.125).abs() < 1e-9);
assert_eq!(iv.timestamp, 1_700_000_000_500);
}
other => panic!("expected Vector, got {other:?}"),
Expand Down
Loading