Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added trace test to debug CI failure #1

Merged
merged 6 commits into from
Jul 27, 2023
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
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
run: mdbook build docs

- name: Upload artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v1
with:
path: ./docs/book
Expand All @@ -53,6 +54,7 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ jobs:
run: cargo build --verbose
- name: Start containers
run: docker-compose up -d
- name: Install self signed certificate
run: sudo cp ./resources/test/certs/cert.pem /usr/local/share/ca-certificates/localhost.crt && sudo update-ca-certificates
- name: Show containers
run: docker-compose ps
- name: Run tests
run: cargo test --verbose --test integration
env:
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin
AWS_REGION: us-east-1
- name: Stop containers
if: always()
run: docker-compose down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ services:
AWS_SECRET_ACCESS_KEY: minioadmin
AWS_DEFAULT_REGION: us-east-1

generate-certificates:
image: docker.io/alpine/openssl
entrypoint: /mnt/scripts/generate-test-certificate
working_dir: /mnt/
volumes:
- source: ./resources/
target: /mnt/resources/
type: bind
- source: ./scripts/
target: /mnt/scripts/
type: bind

nginx:
image: docker.io/library/nginx
network_mode: host
Expand All @@ -51,6 +63,8 @@ services:
deploy:
restart_policy:
condition: on-failure
depends_on:
- generate-certificates
#terrashine:
# image: docker.io/library/rust
# build:
Expand Down
6 changes: 3 additions & 3 deletions integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ use std::{
net::{IpAddr, Ipv6Addr, SocketAddr},
process::Stdio,
str::from_utf8,
time::{Duration, Instant},
time::Duration,
};

use httpmock::{Method::GET, MockServer};
use reqwest::StatusCode;
use sqlx::{pool::PoolOptions, postgres::PgConnectOptions, Postgres};
use terrashine::{self, config::Args};
Expand Down Expand Up @@ -49,6 +48,7 @@ fn test_server_startup(_: PoolOptions<Postgres>, db_options: PgConnectOptions) {
}

#[sqlx::test]
#[traced_test]
fn test_end_to_end_terraform_flow(_: PoolOptions<Postgres>, db_options: PgConnectOptions) {
let config = Args {
database_url: db_options,
Expand All @@ -67,7 +67,7 @@ fn test_end_to_end_terraform_flow(_: PoolOptions<Postgres>, db_options: PgConnec
cancellation_token.child_token(),
tx,
));
let socket = rx.await.unwrap().bind_socket;
let _ = rx.await.unwrap().bind_socket;
let mut terraform = tokio::process::Command::new("terraform");
let process = terraform
.arg("-chdir=resources/test/terraform/random-import-stack/")
Expand Down
Empty file added resources/test/certs/.gitkeep
Empty file.
8 changes: 8 additions & 0 deletions scripts/generate-test-certificate
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
# Generate a self-signed certificate for testing purposes.
create_dir=resources/test/certs
openssl req -x509 -newkey rsa:2048 -keyout ${create_dir}/key.pem -out ${create_dir}/cert.pem -days 10 -nodes \
-subj '/CN=localhost' -sha256\
-addext "subjectAltName = DNS:localhost"

cat ${create_dir}/cert.pem ${create_dir}/key.pem > ./resources/test/nginx/localhost.pem
51 changes: 0 additions & 51 deletions scripts/generate-test-certificate.py

This file was deleted.