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

stasher/azure blob test: use - instead of _ for container name #1366

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions pkg/stash/with_azureblob_test.go
Expand Up @@ -21,7 +21,8 @@ import (
// is done synchronously so that only the first module gets saved.
func TestWithAzureBlob(t *testing.T) {
containerName := randomContainerName(os.Getenv("DRONE_PULL_REQUEST"))
cfg := getAzureTestConfig(containerName)

cfg := getAzureTestConfig(t, containerName)
if cfg == nil {
t.SkipNow()
}
Expand Down Expand Up @@ -84,13 +85,15 @@ func (ms *mockAzureBlobStasher) Stash(ctx context.Context, mod, ver string) (str
return "", fmt.Errorf("second time error")
}

func getAzureTestConfig(containerName string) *config.AzureBlobConfig {
func getAzureTestConfig(t *testing.T, containerName string) *config.AzureBlobConfig {
key := os.Getenv("ATHENS_AZURE_ACCOUNT_KEY")
if key == "" {
t.Log("ATHENS_AZURE_ACCOUNT_KEY not provided.")
return nil
}
name := os.Getenv("ATHENS_AZURE_ACCOUNT_NAME")
name := "athens" //os.Getenv("AZURE_ACCOUNT_NAME")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove the commented os.Getenv call?

if name == "" {
t.Log("AZURE_ACCOUNT_NAME not provided.")
return nil
}
return &config.AzureBlobConfig{
Expand All @@ -105,7 +108,7 @@ func randomContainerName(prefix string) string {
// see https://github.com/technosophos/moniker for more details
namer := moniker.New()
if prefix != "" {
return fmt.Sprintf("%s_%s", prefix, namer.NameSep(""))
return fmt.Sprintf("%s-%s", prefix, namer.NameSep(""))
}
return namer.NameSep("")
}