From 6d9776e8c6ec7fc44a8e50d33c976b25303b7aa8 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Mon, 10 Oct 2022 17:11:13 -0500 Subject: [PATCH] Remove use of invalid AWS cred defaults --- README.md | 4 ++-- archives/archives_test.go | 23 ++++------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 6a7891a..d984471 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ becomes `ARCHIVER_LOG_LEVEL`. -archive-runs whether we should archive runs (default true) -aws-access-key-id string - the access key id to use when authenticating S3 (default "missing_aws_access_key_id") + the access key id to use when authenticating S3 (default none) -aws-secret-access-key string - the secret access key id to use when authenticating S3 (default "missing_aws_secret_access_key") + the secret access key id to use when authenticating S3 (default none) -db string the connection string for our database (default "postgres://localhost/archiver_test?sslmode=disable") -debug-conf diff --git a/archives/archives_test.go b/archives/archives_test.go index 9d17a39..573f344 100644 --- a/archives/archives_test.go +++ b/archives/archives_test.go @@ -37,8 +37,6 @@ func TestGetMissingDayArchives(t *testing.T) { // get the tasks for our org ctx := context.Background() config := NewDefaultConfig() - config.AWSAccessKeyID = "missing_aws_access_key_id" - config.AWSSecretAccessKey = "missing_aws_secret_access_key" orgs, err := GetActiveOrgs(ctx, db, config) assert.NoError(t, err) @@ -88,8 +86,7 @@ func TestGetMissingMonthArchives(t *testing.T) { // get the tasks for our org ctx := context.Background() config := NewDefaultConfig() - config.AWSAccessKeyID = "missing_aws_access_key_id" - config.AWSSecretAccessKey = "missing_aws_secret_access_key" + orgs, err := GetActiveOrgs(ctx, db, config) assert.NoError(t, err) @@ -123,8 +120,6 @@ func TestCreateMsgArchive(t *testing.T) { assert.NoError(t, err) config := NewDefaultConfig() - config.AWSAccessKeyID = "missing_aws_access_key_id" - config.AWSSecretAccessKey = "missing_aws_secret_access_key" orgs, err := GetActiveOrgs(ctx, db, config) assert.NoError(t, err) now := time.Date(2018, 1, 8, 12, 30, 0, 0, time.UTC) @@ -202,8 +197,6 @@ func TestCreateRunArchive(t *testing.T) { assert.NoError(t, err) config := NewDefaultConfig() - config.AWSAccessKeyID = "missing_aws_access_key_id" - config.AWSSecretAccessKey = "missing_aws_secret_access_key" orgs, err := GetActiveOrgs(ctx, db, config) assert.NoError(t, err) now := time.Date(2018, 1, 8, 12, 30, 0, 0, time.UTC) @@ -261,8 +254,6 @@ func TestWriteArchiveToDB(t *testing.T) { ctx := context.Background() config := NewDefaultConfig() - config.AWSAccessKeyID = "missing_aws_access_key_id" - config.AWSSecretAccessKey = "missing_aws_secret_access_key" orgs, err := GetActiveOrgs(ctx, db, config) assert.NoError(t, err) now := time.Date(2018, 1, 8, 12, 30, 0, 0, time.UTC) @@ -317,8 +308,6 @@ func TestArchiveOrgMessages(t *testing.T) { deleteTransactionSize = 1 config := NewDefaultConfig() - config.AWSAccessKeyID = "missing_aws_access_key_id" - config.AWSSecretAccessKey = "missing_aws_secret_access_key" orgs, err := GetActiveOrgs(ctx, db, config) assert.NoError(t, err) now := time.Date(2018, 1, 8, 12, 30, 0, 0, time.UTC) @@ -331,7 +320,7 @@ func TestArchiveOrgMessages(t *testing.T) { config.Delete = true // AWS S3 config in the environment needed to download from S3 - if config.AWSAccessKeyID != "missing_aws_access_key_id" && config.AWSSecretAccessKey != "missing_aws_secret_access_key" { + if config.AWSAccessKeyID != "" && config.AWSSecretAccessKey != "" { s3Client, err := NewS3Client(config) assert.NoError(t, err) @@ -438,8 +427,6 @@ func TestArchiveOrgRuns(t *testing.T) { ctx := context.Background() config := NewDefaultConfig() - config.AWSAccessKeyID = "missing_aws_access_key_id" - config.AWSSecretAccessKey = "missing_aws_secret_access_key" orgs, err := GetActiveOrgs(ctx, db, config) assert.NoError(t, err) now := time.Date(2018, 1, 8, 12, 30, 0, 0, time.UTC) @@ -452,7 +439,7 @@ func TestArchiveOrgRuns(t *testing.T) { config.Delete = true // AWS S3 config in the environment needed to download from S3 - if config.AWSAccessKeyID != "missing_aws_access_key_id" && config.AWSSecretAccessKey != "missing_aws_secret_access_key" { + if config.AWSAccessKeyID != "" && config.AWSSecretAccessKey != "" { s3Client, err := NewS3Client(config) assert.NoError(t, err) @@ -529,8 +516,6 @@ func TestArchiveOrgRuns(t *testing.T) { func TestArchiveActiveOrgs(t *testing.T) { db := setup(t) config := NewDefaultConfig() - config.AWSAccessKeyID = "missing_aws_access_key_id" - config.AWSSecretAccessKey = "missing_aws_secret_access_key" os.Args = []string{"rp-archiver"} loader := ezconf.NewLoader(&config, "archiver", "Archives RapidPro runs and msgs to S3", nil) @@ -543,7 +528,7 @@ func TestArchiveActiveOrgs(t *testing.T) { dates.SetNowSource(dates.NewSequentialNowSource(time.Date(2018, 1, 8, 12, 30, 0, 0, time.UTC))) defer dates.SetNowSource(dates.DefaultNowSource) - if config.AWSAccessKeyID != "missing_aws_access_key_id" && config.AWSSecretAccessKey != "missing_aws_secret_access_key" { + if config.AWSAccessKeyID != "" && config.AWSSecretAccessKey != "" { s3Client, err := NewS3Client(config) assert.NoError(t, err)