Skip to content

Commit

Permalink
eliminate the need for TLS certs in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Aug 28, 2024
1 parent 73357b9 commit c974260
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 207 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v4
Expand All @@ -27,9 +24,6 @@ jobs:
- name: Install juju-db
run: sudo snap install juju-db --channel 4.4/stable

- name: Create test certs
run: make certs

- name: Start test environment
run: docker compose up -d --wait

Expand All @@ -40,11 +34,3 @@ jobs:

- name: Build and Test
run: go test -mod readonly ./... -timeout 1h -cover
env:
JIMM_DSN: postgresql://jimm:jimm@localhost:5432/jimm
JIMM_TEST_PGXDSN: postgresql://jimm:jimm@localhost:5432/jimm
PGHOST: localhost
PGPASSWORD: jimm
PGSSLMODE: disable
PGUSER: jimm
PGPORT: 5432
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ clean:
certs:
@cd local/traefik/certs; ./certs.sh; cd -

test-env: sys-deps certs
test-env: sys-deps
@docker compose up --force-recreate -d --wait

test-env-cleanup:
Expand Down
30 changes: 10 additions & 20 deletions cmd/jaas/cmd/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,41 @@ import (
jujuapi "github.com/juju/juju/api"
"github.com/juju/juju/cmd/modelcmd"
"github.com/juju/juju/jujuclient"

"github.com/canonical/jimm/v3/internal/cmdtest"
)

func NewAddServiceAccountCommandForTesting(store jujuclient.ClientStore, lp jujuapi.LoginProvider) cmd.Command {
cmd := &addServiceAccountCommand{
store: store,
dialOpts: &jujuapi.DialOpts{
InsecureSkipVerify: true,
LoginProvider: lp,
},
store: store,
dialOpts: cmdtest.TestDialOpts(lp),
}

return modelcmd.WrapBase(cmd)
}

func NewListServiceAccountCredentialsCommandForTesting(store jujuclient.ClientStore, lp jujuapi.LoginProvider) cmd.Command {
cmd := &listServiceAccountCredentialsCommand{
store: store,
dialOpts: &jujuapi.DialOpts{
InsecureSkipVerify: true,
LoginProvider: lp,
},
store: store,
dialOpts: cmdtest.TestDialOpts(lp),
}

return modelcmd.WrapBase(cmd)
}

func NewUpdateCredentialsCommandForTesting(store jujuclient.ClientStore, lp jujuapi.LoginProvider) cmd.Command {
cmd := &updateCredentialCommand{
store: store,
dialOpts: &jujuapi.DialOpts{
InsecureSkipVerify: true,
LoginProvider: lp,
},
store: store,
dialOpts: cmdtest.TestDialOpts(lp),
}

return modelcmd.WrapBase(cmd)
}

func NewGrantCommandForTesting(store jujuclient.ClientStore, lp jujuapi.LoginProvider) cmd.Command {
cmd := &grantCommand{
store: store,
dialOpts: &jujuapi.DialOpts{
InsecureSkipVerify: true,
LoginProvider: lp,
},
store: store,
dialOpts: cmdtest.TestDialOpts(lp),
}

return modelcmd.WrapBase(cmd)
Expand Down
Loading

0 comments on commit c974260

Please sign in to comment.