Skip to content

Commit

Permalink
Merger with 22-create-model
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsSR committed Nov 28, 2023
2 parents 98ea497 + 3cb26ae commit 2609820
Show file tree
Hide file tree
Showing 25 changed files with 2,747 additions and 2,683 deletions.
41 changes: 35 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,48 @@ on:

env:
CARGO_TERM_COLOR: always
TEST_DATABASE_URL: "sqlite::memory:"

jobs:
test:
# Label of the container job
container-job:
# Containers must run in Linux based operating systems
runs-on: ubuntu-latest
# Docker Hub image that `container-job` executes in
container: rust

# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
ports:
- 5432:5432
# Provide the password and db name for postgres
env:
POSTGRES_PASSWORD: 1234
POSTGRES_DB: ecdar_api
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: true
- name: Install Protoc
submodules: 'true'

- name: Install dependencies
uses: arduino/setup-protoc@v2

- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Run tests
run: cargo test --verbose
env:
TEST_DATABASE_URL: "postgresql://postgres:1234@postgres:5432/ecdar_api"
run: cargo test -- --test-threads=1
21 changes: 21 additions & 0 deletions src/api/context_collection.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use crate::api::hashing_context::HashingContextTrait;
use crate::api::server::server::ecdar_backend_server::EcdarBackend;
use crate::database::access_context::AccessContextTrait;
use crate::database::in_use_context::InUseContextTrait;
use crate::database::model_context::ModelContextTrait;
use crate::database::query_context::QueryContextTrait;
use crate::database::session_context::SessionContextTrait;
use crate::database::user_context::UserContextTrait;
use std::sync::Arc;

#[derive(Clone)]
pub struct ContextCollection {
pub(crate) access_context: Arc<dyn AccessContextTrait>,
pub(crate) in_use_context: Arc<dyn InUseContextTrait>,

Check warning on line 14 in src/api/context_collection.rs

View workflow job for this annotation

GitHub Actions / Clippy lint and check

field `in_use_context` is never read

warning: field `in_use_context` is never read --> src/api/context_collection.rs:14:16 | 12 | pub struct ContextCollection { | ----------------- field in this struct 13 | pub(crate) access_context: Arc<dyn AccessContextTrait>, 14 | pub(crate) in_use_context: Arc<dyn InUseContextTrait>, | ^^^^^^^^^^^^^^ | = note: `ContextCollection` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis

Check warning on line 14 in src/api/context_collection.rs

View workflow job for this annotation

GitHub Actions / Clippy lint and check

field `in_use_context` is never read

warning: field `in_use_context` is never read --> src/api/context_collection.rs:14:16 | 12 | pub struct ContextCollection { | ----------------- field in this struct 13 | pub(crate) access_context: Arc<dyn AccessContextTrait>, 14 | pub(crate) in_use_context: Arc<dyn InUseContextTrait>, | ^^^^^^^^^^^^^^ | = note: `ContextCollection` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis = note: `#[warn(dead_code)]` on by default
pub(crate) model_context: Arc<dyn ModelContextTrait>,
pub(crate) query_context: Arc<dyn QueryContextTrait>,
pub(crate) session_context: Arc<dyn SessionContextTrait>,
pub(crate) user_context: Arc<dyn UserContextTrait>,
pub(crate) reveaal_context: Arc<dyn EcdarBackend>,
pub(crate) hashing_context: Arc<dyn HashingContextTrait>,
}
Loading

0 comments on commit 2609820

Please sign in to comment.