Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone committed Jul 17, 2023
1 parent 5bd3d85 commit 8203d5d
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 52 deletions.
4 changes: 2 additions & 2 deletions internal/namespaces/iam/v1alpha1/custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (

func Test_initWithSSHKeyCommand(t *testing.T) {
tmpDir := os.TempDir()
key := `ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0= foobar@foobar`
key := `ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn9mGL7LGZ6/RTIVP7GExiD5gOwgl63MbJGlL7a6U3x foo@foobar.com`
t.Run("simple", core.Test(&core.TestConfig{
Commands: GetCommands(),
BeforeFunc: func(ctx *core.BeforeFuncCtx) error {
pathToPublicKey := path.Join(tmpDir, ".ssh", "id_rsa.pub")
pathToPublicKey := path.Join(tmpDir, ".ssh", "id_ed25519.pub")
_, err := os.Stat(pathToPublicKey)
if err != nil {
err := os.MkdirAll(path.Join(tmpDir, ".ssh"), 0755)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,74 @@
version: 1
interactions:
- request:
body: ""
body: '{"ssh_keys":[{"id":"495d0e9f-a22b-4ff5-8324-0cb4746c57dc", "name":"[email protected]",
"public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl
[email protected]", "fingerprint":"256 MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55
[email protected] (ssh-ed25519)", "created_at":"2022-03-29T07:50:11.839583Z",
"updated_at":"2022-03-29T07:50:17.762922Z", "organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"project_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "disabled":false}, {"id":"e2e9d140-c387-43e8-af1b-5b133f8fe90d",
"name":"leila''s ssh-key", "public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIG4S+vO03k8VY0qdhRThHbyiDFbIqvzH+94x24b4hbQ
lmarabese", "fingerprint":"256 MD5:69:c9:cf:52:7d:07:cc:ff:a4:58:e4:7e:96:77:18:63
lmarabese (ssh-ed25519)", "created_at":"2023-02-07T10:19:17.608707Z", "updated_at":"2023-02-07T10:19:17.608707Z",
"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "project_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"disabled":false}, {"id":"1f5abae8-78f7-41a2-a787-780166d3f736", "name":"foobar",
"public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0=
foobar@foobar", "fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44
foobar@foobar (ecdsa-sha2-nistp256)", "created_at":"2023-07-17T14:47:52.688903Z",
"updated_at":"2023-07-17T14:47:52.688903Z", "organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"project_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "disabled":false}, {"id":"459e72de-56f0-4177-a3fd-f8bf47571915",
"name":"foobar", "public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0=
foobar@foobar", "fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44
foobar@foobar (ecdsa-sha2-nistp256)", "created_at":"2023-07-17T14:47:55.834080Z",
"updated_at":"2023-07-17T14:47:55.834080Z", "organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"project_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "disabled":false}, {"id":"e4572020-36e1-41fc-9bbc-2faa56c12e93",
"name":"key-elastic-allen", "public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn9mGL7LGZ6/RTIVP7GExiD5gOwgl63MbJGlL7a6U3x
[email protected]", "fingerprint":"256 MD5:1e:f8:f7:cb:c4:b7:a8:6d:96:20:49:d0:d0:af:a0:9e
[email protected] (ssh-ed25519)", "created_at":"2023-07-17T15:05:30.415306Z", "updated_at":"2023-07-17T15:05:30.415306Z",
"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "project_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"disabled":false}], "total_count":5}'
form: {}
headers:
User-Agent:
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.20.6; darwin; amd64) cli-e2e-test
url: https://api.scaleway.com/iam/v1alpha1/ssh-keys?order_by=created_at_asc&page=1
method: GET
response:
body: '{"ssh_keys":[],"total_count":0}'
body: '{"ssh_keys":[{"id":"495d0e9f-a22b-4ff5-8324-0cb4746c57dc", "name":"[email protected]",
"public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM6Lfs9IrfEUsw2oALOKucAqjeJo3vdADJAZS0BrJ4Vl
[email protected]", "fingerprint":"256 MD5:0d:6d:20:43:4c:0f:38:a3:65:de:8f:72:77:70:26:55
[email protected] (ssh-ed25519)", "created_at":"2022-03-29T07:50:11.839583Z",
"updated_at":"2022-03-29T07:50:17.762922Z", "organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"project_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "disabled":false}, {"id":"e2e9d140-c387-43e8-af1b-5b133f8fe90d",
"name":"leila''s ssh-key", "public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIG4S+vO03k8VY0qdhRThHbyiDFbIqvzH+94x24b4hbQ
lmarabese", "fingerprint":"256 MD5:69:c9:cf:52:7d:07:cc:ff:a4:58:e4:7e:96:77:18:63
lmarabese (ssh-ed25519)", "created_at":"2023-02-07T10:19:17.608707Z", "updated_at":"2023-02-07T10:19:17.608707Z",
"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "project_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"disabled":false}, {"id":"1f5abae8-78f7-41a2-a787-780166d3f736", "name":"foobar",
"public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0=
foobar@foobar", "fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44
foobar@foobar (ecdsa-sha2-nistp256)", "created_at":"2023-07-17T14:47:52.688903Z",
"updated_at":"2023-07-17T14:47:52.688903Z", "organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"project_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "disabled":false}, {"id":"459e72de-56f0-4177-a3fd-f8bf47571915",
"name":"foobar", "public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0=
foobar@foobar", "fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44
foobar@foobar (ecdsa-sha2-nistp256)", "created_at":"2023-07-17T14:47:55.834080Z",
"updated_at":"2023-07-17T14:47:55.834080Z", "organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"project_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "disabled":false}, {"id":"e4572020-36e1-41fc-9bbc-2faa56c12e93",
"name":"key-elastic-allen", "public_key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBn9mGL7LGZ6/RTIVP7GExiD5gOwgl63MbJGlL7a6U3x
[email protected]", "fingerprint":"256 MD5:1e:f8:f7:cb:c4:b7:a8:6d:96:20:49:d0:d0:af:a0:9e
[email protected] (ssh-ed25519)", "created_at":"2023-07-17T15:05:30.415306Z", "updated_at":"2023-07-17T15:05:30.415306Z",
"organization_id":"951df375-e094-4d26-97c1-ba548eeb9c42", "project_id":"951df375-e094-4d26-97c1-ba548eeb9c42",
"disabled":false}], "total_count":5}'
headers:
Content-Length:
- "3508"
- "2710"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Wed, 15 Feb 2023 16:02:46 GMT
- Mon, 17 Jul 2023 15:18:21 GMT
Server:
- Scaleway API-Gateway
Strict-Transport-Security:
Expand All @@ -29,45 +79,7 @@ interactions:
X-Frame-Options:
- DENY
X-Request-Id:
- 6139b965-ed34-498c-8e8d-ad77b24e9c4d
status: 200 OK
code: 200
duration: ""
- request:
body: '{"name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0=
foobar@foobar","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a"}'
form: {}
headers:
Content-Type:
- application/json
User-Agent:
- scaleway-sdk-go/v1.0.0-beta.7+dev (go1.19; darwin; amd64) cli-e2e-test
url: https://api.scaleway.com/iam/v1alpha1/ssh-keys
method: POST
response:
body: '{"id":"70581bce-87f3-4625-b481-f75b24e52a3b","name":"key-keen-elgamal","public_key":"ecdsa-sha2-nistp256
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBBieay3nO9wViPkuvFVgGGaA1IRlkFrr946yqvg9LxZIRhsnZ61yLCPmIOhvUAZ/gTxZGmhgtMDxkenSUTsG3F0=
foobar@foobar","fingerprint":"256 MD5:19:ec:90:3b:95:c6:d8:93:ac:e1:14:4c:0e:cb:ea:44
foobar@foobar (ecdsa-sha2-nistp256)","created_at":"2023-02-15T16:02:46.819741Z","updated_at":"2023-02-15T16:02:46.819741Z","organization_id":"63a66ec9-a385-4194-bc15-04aa6921274a","project_id":"63a66ec9-a385-4194-bc15-04aa6921274a","disabled":false}'
headers:
Content-Length:
- "581"
Content-Security-Policy:
- default-src 'none'; frame-ancestors 'none'
Content-Type:
- application/json
Date:
- Wed, 15 Feb 2023 16:02:46 GMT
Server:
- Scaleway API-Gateway
Strict-Transport-Security:
- max-age=63072000
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- DENY
X-Request-Id:
- 953b4083-ca64-4997-9450-55127c9cc88f
- c75be1c4-288c-486f-86af-5737738288b6
status: 200 OK
code: 200
duration: ""
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟩🟩🟩 STDOUT️ 🟩🟩🟩️
βœ… Key ~/.ssh/id_rsa.pub successfully added.
🟩🟩🟩 JSON STDOUT 🟩🟩🟩
{
"message": "Key ~/.ssh/id_rsa.pub successfully added",
"details": ""
}
-

0 comments on commit 8203d5d

Please sign in to comment.