Skip to content

Commit

Permalink
refactor: Make tests seperated crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Weijun-H committed Oct 18, 2024
1 parent fa713f9 commit e39d950
Show file tree
Hide file tree
Showing 18 changed files with 186 additions and 457 deletions.
511 changes: 83 additions & 428 deletions Cargo.lock

Large diffs are not rendered by default.

39 changes: 10 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ crate-type = ["cdylib", "rlib"]

[features]
default = ["pg17"]
pg13 = ["pgrx/pg13", "pgrx-tests/pg13", "supabase-wrappers/pg13"]
pg14 = ["pgrx/pg14", "pgrx-tests/pg14", "supabase-wrappers/pg14"]
pg15 = ["pgrx/pg15", "pgrx-tests/pg15", "supabase-wrappers/pg15"]
pg16 = ["pgrx/pg16", "pgrx-tests/pg16", "supabase-wrappers/pg16"]
pg17 = ["pgrx/pg17", "pgrx-tests/pg17", "supabase-wrappers/pg17"]
pg13 = ["pgrx/pg13", "supabase-wrappers/pg13"]
pg14 = ["pgrx/pg14", "supabase-wrappers/pg14"]
pg15 = ["pgrx/pg15", "supabase-wrappers/pg15"]
pg16 = ["pgrx/pg16", "supabase-wrappers/pg16"]
pg17 = ["pgrx/pg17", "supabase-wrappers/pg17"]
pg_test = []

[dependencies]
Expand All @@ -36,31 +36,12 @@ thiserror = "1.0.63"
uuid = "1.10.0"

[dev-dependencies]
aws-config = "1.5.6"
aws-sdk-s3 = "1.49.0"
bigdecimal = { version = "0.3.1", features = ["serde"] }
bytes = "1.7.1"
datafusion = "37.1.0"
deltalake = { version = "0.17.3", features = ["datafusion"] }
futures = "0.3.30"
pgrx-tests = "0.12.6"
rstest = "0.19.0"
serde_arrow = { version = "0.11.7", features = ["arrow-51"] }
soa_derive = "0.13.0"
sqlx = { version = "0.7.4", features = [
"postgres",
"runtime-async-std",
"time",
"bigdecimal",
"uuid",
"chrono",
] }
tempfile = "3.12.0"
testcontainers = "0.16.7"
testcontainers-modules = { version = "0.4.3", features = ["localstack"] }
time = { version = "0.3.36", features = ["serde"] }
geojson = "0.24.1"


[[bin]]
name = "pgrx_embed_pg_analytics"
path = "src/bin/pgrx_embed.rs"

[workspace]
resolver = "2"
members = ["tests"]
56 changes: 56 additions & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[package]
name = "tests"
description = "test suite for pg_analytics"
version = "0.2.1"
edition = "2021"
license = "AGPL-3.0"

[lib]
crate-type = ["rlib"]

[features]
pg17 = ["pgrx/pg17"]
pg16 = ["pgrx/pg16"]
pg15 = ["pgrx/pg15"]
pg14 = ["pgrx/pg14"]
pg13 = ["pgrx/pg13"]

[dependencies]

[dev-dependencies]
anyhow = "1.0.88"
async-std = { version = "1.13.0", features = ["tokio1", "attributes"] }
chrono = "0.4.38"
duckdb = { git = "https://github.com/paradedb/duckdb-rs.git", features = [
"bundled",
"extensions-full",
], rev = "e532dd6" }
pgrx = "0.12.6"
serde = "1.0.210"
serde_json = "1.0.128"
signal-hook = "0.3.17"
thiserror = "1.0.63"
uuid = "1.10.0"
aws-config = "1.5.6"
aws-sdk-s3 = "1.49.0"
bigdecimal = { version = "0.3.1", features = ["serde"] }
bytes = "1.7.1"
datafusion = "37.1.0"
deltalake = { version = "0.17.3", features = ["datafusion"] }
futures = "0.3.30"
rstest = "0.19.0"
serde_arrow = { version = "0.11.7", features = ["arrow-51"] }
soa_derive = "0.13.0"
sqlx = { version = "0.7.4", features = [
"postgres",
"runtime-async-std",
"time",
"bigdecimal",
"uuid",
"chrono",
] }
tempfile = "3.12.0"
testcontainers = "0.16.7"
testcontainers-modules = { version = "0.4.3", features = ["localstack"] }
time = { version = "0.3.36", features = ["serde"] }
geojson = "0.24.1"
18 changes: 18 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Test suite for `pg_analytics

This is the test suite for the `pg_analytics` extension.

An example of doing all that's necessary to run the tests is, from the root of the repo is:

```shell
#! /bin/sh

set -x
export DATABASE_URL=postgresql://localhost:28816/pg_analytics
export RUST_BACKTRACE=1
cargo pgrx stop --package pg_analytics
cargo pgrx install --package pg_analytics --pg-config ~/.pgrx/16.4/pgrx-install/bin/pg_config
cargo pgrx start --package pg_analytics

cargo test --package tests --features pg16
```
19 changes: 19 additions & 0 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2023-2024 Retake, Inc.
//
// This file is part of ParadeDB - Postgres for Search and Analytics
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

#[allow(dead_code)]
pub fn this_file_intentionally_left_blank() {}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit e39d950

Please sign in to comment.