Skip to content

Commit 3a9a4f3

Browse files
committed
Simplify integration tests for sequential execution
1 parent 6e684a7 commit 3a9a4f3

File tree

5 files changed

+9
-23
lines changed

5 files changed

+9
-23
lines changed

.github/workflows/integration-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ jobs:
2121
if: |
2222
github.event_name != 'pull_request_target' ||
2323
github.event.pull_request.author_association == 'COLLABORATOR' ||
24-
contains(github.event.pull_request.labels.*.name, 'safe to test')
24+
contains(github.event.pull_request.labels.*.name, 'safe-to-test')
2525
2626
permissions:
2727
id-token: write
2828
contents: read
2929

3030
steps:
31-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@v5
3232
with:
3333
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
3434

@@ -48,7 +48,7 @@ jobs:
4848
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
4949

5050
- name: Configure AWS credentials
51-
uses: aws-actions/configure-aws-credentials@v4
51+
uses: aws-actions/configure-aws-credentials@v5
5252
with:
5353
role-to-assume: ${{ secrets.ROLE_ARN }}
5454
role-session-name: secrets-manager-agent-ci-${{ github.run_id }}

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ jobs:
4848
- name: Build
4949
run: cargo build --verbose
5050
- name: Run tests
51-
run: cargo test --verbose --all-features --no-fail-fast
51+
run: cargo test --verbose --all-features --no-fail-fast --workspace --exclude integration-tests
5252
- name: Code Coverage
53-
run: cargo llvm-cov --all-features --workspace --codecov --output-path ./codecov.json
53+
run: cargo llvm-cov --all-features --workspace --exclude integration-tests --codecov --output-path ./codecov.json
5454
- name: Publish Code Coverage
5555
uses: codecov/codecov-action@v5
5656
with:

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-tests/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ aws-config = "1"
1313
aws-sdk-secretsmanager = "1"
1414
url = "2"
1515
derive_builder = "0.20"
16-
fastrand = "2"
1716

integration-tests/tests/common.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ use std::env;
55
use std::fmt;
66
use std::path::PathBuf;
77
use std::process::Stdio;
8-
use std::sync::atomic::{AtomicU16, Ordering};
98
use std::time::Duration;
109
use tokio::io::{AsyncBufReadExt, BufReader};
1110
use tokio::process::Command as TokioCommand;
1211
use url::Url;
1312

14-
static PORT_COUNTER: AtomicU16 = AtomicU16::new(2775);
15-
1613
#[derive(Debug, Clone, Copy)]
1714
pub enum SecretType {
1815
Basic,
@@ -81,8 +78,7 @@ pub struct AgentProcess {
8178

8279
impl AgentProcess {
8380
pub async fn start() -> AgentProcess {
84-
let port = PORT_COUNTER.fetch_add(1, Ordering::SeqCst);
85-
Self::start_with_config(port, 5).await
81+
Self::start_with_config(2775, 5).await
8682
}
8783

8884
pub async fn start_with_config(port: u16, ttl_seconds: u16) -> AgentProcess {
@@ -196,20 +192,12 @@ impl TestSecrets {
196192
}
197193

198194
pub async fn setup() -> Self {
199-
use std::collections::hash_map::DefaultHasher;
200-
use std::hash::{Hash, Hasher};
201-
202-
let mut hasher = DefaultHasher::new();
203-
std::thread::current().id().hash(&mut hasher);
204-
std::time::SystemTime::now()
195+
let timestamp = std::time::SystemTime::now()
205196
.duration_since(std::time::UNIX_EPOCH)
206197
.unwrap()
207-
.as_nanos()
208-
.hash(&mut hasher);
209-
fastrand::u64(..).hash(&mut hasher);
210-
let hash = hasher.finish();
198+
.as_nanos();
211199

212-
let test_prefix = format!("aws-sm-agent-test-{}", hash);
200+
let test_prefix = format!("aws-sm-agent-test-{}", timestamp);
213201

214202
let config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await;
215203
let client = aws_sdk_secretsmanager::Client::new(&config);

0 commit comments

Comments
 (0)