Skip to content

Commit

Permalink
Move tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Aug 19, 2024
1 parent 63599e7 commit 8f7398b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vault-kv/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dagger.gen.go
/internal/dagger
/internal/querybuilder
/internal/telemetry
4 changes: 2 additions & 2 deletions dagger.json → vault-kv/tests/dagger.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "vault",
"name": "tests",
"sdk": "go",
"dependencies": [
{
"name": "vault-kv",
"source": "vault-kv"
"source": ".."
}
],
"source": ".",
Expand Down
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions main.go → vault-kv/tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import (
"main/internal/dagger"
)

type Vault struct {
type Tests struct {
// Predefined token to be used.
Token string
}

func New() *Vault {
return &Vault{
func New() *Tests {
return &Tests{
Token: "sesame",
}
}

// The `vault-server` command creates a vault server instance and returns it as a service.
func (m *Vault) VaultServer() *dagger.Service {
func (m *Tests) VaultServer() *dagger.Service {
return dag.Container().
From("hashicorp/vault:1.17.3").
WithEnvVariable("VAULT_DEV_ROOT_TOKEN_ID", m.Token).
Expand All @@ -31,7 +31,7 @@ func (m *Vault) VaultServer() *dagger.Service {
}

// The `test` command creates and starts a vault server instance, creates a new secret and reads it afterwards.
func (m *Vault) Test(ctx context.Context) (error) {
func (m *Tests) Test(ctx context.Context) (error) {
secretPath := "/secret/test"
secretKey := fmt.Sprintf("%x", (md5.Sum([]byte(time.Now().String()))))[0:8]
secretValue := "expected"
Expand Down

0 comments on commit 8f7398b

Please sign in to comment.