Skip to content

Commit

Permalink
Update documentation and docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
serverlesstechnology authored and Dave Garred committed Apr 18, 2022
1 parent 9ad2c13 commit 459fa69
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mysql-es"
version = "0.3.1"
version = "0.3.2"
authors = ["Dave Garred <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.40 as builder
FROM rust:1.60 as builder

WORKDIR /home/build
RUN git clone https://github.com/serverlesstechnology/mysql-es.git
Expand Down
17 changes: 17 additions & 0 deletions buildspec_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 0.2

phases:
install:
commands:
- echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
pre_build:
commands:
- docker build -t mysql-es .
build:
commands:
- docker-compose up -d
- docker ps
- docker image inspect mysql-es
- docker run --network="host" mysql-es cargo test
19 changes: 15 additions & 4 deletions src/testing.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#[cfg(test)]
pub(crate) mod tests {

use async_trait::async_trait;
use cqrs_es::persist::{GenericQuery, SerializedEvent, SerializedSnapshot};
use cqrs_es::{Aggregate, AggregateError, DomainEvent, EventEnvelope, UserErrorPayload, View};
use cqrs_es::{Aggregate, AggregateError, DomainEvent, EventEnvelope, View};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::fmt::{Display, Formatter};

use crate::view_repository::MysqlViewRepository;

Expand All @@ -20,7 +20,7 @@ pub(crate) mod tests {
impl Aggregate for TestAggregate {
type Command = TestCommand;
type Event = TestEvent;
type Error = UserErrorPayload;
type Error = TestError;

fn aggregate_type() -> String {
"TestAggregate".to_string()
Expand Down Expand Up @@ -82,6 +82,17 @@ pub(crate) mod tests {
}
}

#[derive(Debug, PartialEq)]
pub struct TestError(String);

impl Display for TestError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}

impl std::error::Error for TestError {}

pub enum TestCommand {}

pub(crate) type TestQueryRepository =
Expand All @@ -99,7 +110,7 @@ pub(crate) mod tests {
}

pub(crate) const TEST_CONNECTION_STRING: &str =
"mysql://test_user:test_pass@localhost:3306/test";
"mysql://test_user:test_pass@127.0.0.1:3306/test";

pub(crate) fn test_event_envelope(
id: &str,
Expand Down
2 changes: 1 addition & 1 deletion tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use mysql_es::{default_mysql_pool, MysqlEventRepository};
use serde_json::Value;
use sqlx::{MySql, Pool};

const TEST_CONNECTION_STRING: &str = "mysql://test_user:test_pass@localhost:3306/test";
const TEST_CONNECTION_STRING: &str = "mysql://test_user:test_pass@127.0.0.1:3306/test";

async fn new_test_event_store(
pool: Pool<MySql>,
Expand Down

0 comments on commit 459fa69

Please sign in to comment.