-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8a1811
commit 0274f77
Showing
9 changed files
with
189 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
configured_endpoints: 17 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nirvana-labs%2Fnirvana-901357ab068797fff926718b5f7f307dc332f52a1d494ee340352e50bc09b641.yml | ||
configured_endpoints: 20 | ||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nirvana-labs%2Fnirvana-88eef6692dd2f29d0734587b0a255ce12fff9fa28b6c1d66d2b61364d2d0c311.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. | ||
|
||
package volumes_test | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
"os" | ||
"testing" | ||
|
||
"github.com/nirvana-labs/nirvana-go" | ||
"github.com/nirvana-labs/nirvana-go/internal/testutil" | ||
"github.com/nirvana-labs/nirvana-go/option" | ||
"github.com/nirvana-labs/nirvana-go/volumes" | ||
) | ||
|
||
func TestVolumeNewWithOptionalParams(t *testing.T) { | ||
baseURL := "http://localhost:4010" | ||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { | ||
baseURL = envURL | ||
} | ||
if !testutil.CheckTestServer(t, baseURL) { | ||
return | ||
} | ||
client := nirvana.NewClient( | ||
option.WithBaseURL(baseURL), | ||
option.WithAuthToken("My Auth Token"), | ||
) | ||
_, err := client.Volumes.New(context.TODO(), volumes.VolumeNewParams{ | ||
Size: nirvana.F(int64(100)), | ||
VMID: nirvana.F("vm_id"), | ||
Type: nirvana.F(volumes.StorageTypeNvme), | ||
}) | ||
if err != nil { | ||
var apierr *nirvana.Error | ||
if errors.As(err, &apierr) { | ||
t.Log(string(apierr.DumpRequest(true))) | ||
} | ||
t.Fatalf("err should be nil: %s", err.Error()) | ||
} | ||
} | ||
|
||
func TestVolumeUpdate(t *testing.T) { | ||
baseURL := "http://localhost:4010" | ||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { | ||
baseURL = envURL | ||
} | ||
if !testutil.CheckTestServer(t, baseURL) { | ||
return | ||
} | ||
client := nirvana.NewClient( | ||
option.WithBaseURL(baseURL), | ||
option.WithAuthToken("My Auth Token"), | ||
) | ||
_, err := client.Volumes.Update( | ||
context.TODO(), | ||
"volume_id", | ||
volumes.VolumeUpdateParams{ | ||
Size: nirvana.F(int64(100)), | ||
VMID: nirvana.F("vm_id"), | ||
}, | ||
) | ||
if err != nil { | ||
var apierr *nirvana.Error | ||
if errors.As(err, &apierr) { | ||
t.Log(string(apierr.DumpRequest(true))) | ||
} | ||
t.Fatalf("err should be nil: %s", err.Error()) | ||
} | ||
} | ||
|
||
func TestVolumeDelete(t *testing.T) { | ||
baseURL := "http://localhost:4010" | ||
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { | ||
baseURL = envURL | ||
} | ||
if !testutil.CheckTestServer(t, baseURL) { | ||
return | ||
} | ||
client := nirvana.NewClient( | ||
option.WithBaseURL(baseURL), | ||
option.WithAuthToken("My Auth Token"), | ||
) | ||
_, err := client.Volumes.Delete( | ||
context.TODO(), | ||
"volume_id", | ||
volumes.VolumeDeleteParams{ | ||
VMID: nirvana.F("vm_id"), | ||
}, | ||
) | ||
if err != nil { | ||
var apierr *nirvana.Error | ||
if errors.As(err, &apierr) { | ||
t.Log(string(apierr.DumpRequest(true))) | ||
} | ||
t.Fatalf("err should be nil: %s", err.Error()) | ||
} | ||
} |