Skip to content

Commit

Permalink
Merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsSR committed Nov 28, 2023
2 parents 3110aea + d29b0c0 commit 0b19a81
Show file tree
Hide file tree
Showing 25 changed files with 2,766 additions and 2,697 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>,
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 0b19a81

Please sign in to comment.