Skip to content

Commit

Permalink
Fix rebasing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathsreekanth committed Dec 13, 2024
1 parent c20aa79 commit 97b4725
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 30 deletions.
6 changes: 3 additions & 3 deletions api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func TestClientVersion(t *testing.T) {
}

// Test unauthorized authentication
_, err = client.Authenticate(context.Background(), &ConfigConnect{
_, err = client.Authenticate(&ConfigConnect{
Username: "ScaleIOUser",
Password: "badpassword",
Endpoint: "",
Expand All @@ -161,12 +161,12 @@ func TestClientVersion(t *testing.T) {
}

// Test for version retrieval with retry
_, err = client.GetVersion(context.Background())
_, err = client.GetVersion()
if err != nil {
// Check if the error is due to unauthorized access
if strings.Contains(err.Error(), "Unauthorized") {
//retry
_, err = client.Authenticate(context.Background(), &ConfigConnect{
_, err = client.Authenticate(&ConfigConnect{
Username: "ScaleIOUser",
Password: "password",
Endpoint: "",
Expand Down
5 changes: 2 additions & 3 deletions compatibility_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package goscaleio

import (
"context"
"encoding/json"
"math"
"net/http"
Expand Down Expand Up @@ -73,7 +72,7 @@ func TestGetCompatibility(t *testing.T) {
client: client,
}

_, err = s.GetCompatibilityManagement(context.Background())
_, err = s.GetCompatibilityManagement()
if err != nil {
if tc.error != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -109,7 +108,7 @@ func TestSetCompatibility(t *testing.T) {
client: client,
}

_, err = s.SetCompatibilityManagement(context.Background(), &tc.compatibilitymanagement)
_, err = s.SetCompatibilityManagement(&tc.compatibilitymanagement)
if err != nil {
if tc.error != err.Error() {
t.Fatal(err)
Expand Down
29 changes: 14 additions & 15 deletions device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package goscaleio

import (
"context"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -118,7 +117,7 @@ func TestGetAllDevices(t *testing.T) {
client: client,
}

_, err = s.GetAllDevice(context.Background())
_, err = s.GetAllDevice()
if err != nil {
if tc.expectedErr.Error() != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -177,7 +176,7 @@ func TestGetDevice(t *testing.T) {
client: client,
}

_, err = s.GetDevice(context.Background(), "1")
_, err = s.GetDevice("1")
if err != nil {
if tc.expectedErr.Error() != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -271,7 +270,7 @@ func TestGetDeviceByField(t *testing.T) {

temp := deviceFields[id]
for fieldKey, fieldValue := range temp {
_, err = s.GetDeviceByField(context.Background(), fieldKey, fieldValue)
_, err = s.GetDeviceByField(fieldKey, fieldValue)
if err != nil {
if tc.expectedErr.Error() != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -362,7 +361,7 @@ func TestSDSFindDevice(t *testing.T) {
sds.Sds.Name = "mock-sds-name"
sds.Sds.ID = "mock-sds-id"
for fieldKey, fieldValue := range deviceFields[id] {
_, err = sds.FindDevice(context.Background(), fieldKey, fieldValue)
_, err = sds.FindDevice(fieldKey, fieldValue)
if err != nil {
if tc.expectedErr.Error() != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -423,7 +422,7 @@ func TestSDSGetDevice(t *testing.T) {
sds := NewSds(client)
sds.Sds.Name = "mock-sds-name"
sds.Sds.ID = "mock-sds-id"
_, err = sds.GetDevice(context.Background())
_, err = sds.GetDevice()
if err != nil {
if tc.expectedErr.Error() != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -482,7 +481,7 @@ func TestStoragePoolGetDevice(t *testing.T) {
pool := NewStoragePool(client)
pool.StoragePool.Name = "mock-storage-pool-name"

_, err = pool.GetDevice(context.Background())
_, err = pool.GetDevice()
if err != nil {
if tc.expectedErr.Error() != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -571,7 +570,7 @@ func TestStoragePoolFindDevice(t *testing.T) {
pool.StoragePool.Name = "mock-storage-pool-name"
pool.StoragePool.ID = "mock-storage-pool-id"
for fieldKey, fieldValue := range deviceFields[id] {
_, err = pool.FindDevice(context.Background(), fieldKey, fieldValue)
_, err = pool.FindDevice(fieldKey, fieldValue)
if err != nil {
if tc.expectedErr.Error() != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -635,7 +634,7 @@ func TestStoragePoolSetDeviceName(t *testing.T) {

client, _ := NewClientWithArgs(server.URL, "", math.MaxInt64, true, false)
storagePool := NewStoragePool(client)
err := storagePool.SetDeviceName(context.Background(), "mock-device-id", "mock-device-name")
err := storagePool.SetDeviceName("mock-device-id", "mock-device-name")

for _, checkFn := range checkFns {
checkFn(t, err)
Expand Down Expand Up @@ -696,7 +695,7 @@ func TestStoragePoolSetMediaType(t *testing.T) {

client, _ := NewClientWithArgs(server.URL, "", math.MaxInt64, true, false)
storagePool := NewStoragePool(client)
err := storagePool.SetDeviceMediaType(context.Background(), "mock-device-id", "mock-media-type")
err := storagePool.SetDeviceMediaType("mock-device-id", "mock-media-type")

for _, checkFn := range checkFns {
checkFn(t, err)
Expand Down Expand Up @@ -757,7 +756,7 @@ func TestStoragePoolSetDeviceExternalAccelerationType(t *testing.T) {

client, _ := NewClientWithArgs(server.URL, "", math.MaxInt64, true, false)
storagePool := NewStoragePool(client)
err := storagePool.SetDeviceExternalAccelerationType(context.Background(), "mock-device-id", "mock-acceleration-type")
err := storagePool.SetDeviceExternalAccelerationType("mock-device-id", "mock-acceleration-type")

for _, checkFn := range checkFns {
checkFn(t, err)
Expand Down Expand Up @@ -818,7 +817,7 @@ func TestStoragePoolSetDeviceCapacityLimit(t *testing.T) {

client, _ := NewClientWithArgs(server.URL, "", math.MaxInt64, true, false)
storagePool := NewStoragePool(client)
err := storagePool.SetDeviceCapacityLimit(context.Background(), "mock-device-id", "100G")
err := storagePool.SetDeviceCapacityLimit("mock-device-id", "100G")

for _, checkFn := range checkFns {
checkFn(t, err)
Expand Down Expand Up @@ -879,7 +878,7 @@ func TestStoragePoolUpdateDeviceOriginalPathways(t *testing.T) {

client, _ := NewClientWithArgs(server.URL, "", math.MaxInt64, true, false)
storagePool := NewStoragePool(client)
err := storagePool.UpdateDeviceOriginalPathways(context.Background(), "mock-device-id")
err := storagePool.UpdateDeviceOriginalPathways("mock-device-id")

for _, checkFn := range checkFns {
checkFn(t, err)
Expand Down Expand Up @@ -940,7 +939,7 @@ func TestStoragePoolRemoveDevice(t *testing.T) {

client, _ := NewClientWithArgs(server.URL, "", math.MaxInt64, true, false)
storagePool := NewStoragePool(client)
err := storagePool.RemoveDevice(context.Background(), "mock-device-id")
err := storagePool.RemoveDevice("mock-device-id")

for _, checkFn := range checkFns {
checkFn(t, err)
Expand Down Expand Up @@ -1003,7 +1002,7 @@ func TestStoragePoolAttachDevice(t *testing.T) {
deviceParam := &types.DeviceParam{
Name: "mock-device-name",
}
_, err := storagePool.AttachDevice(context.Background(), deviceParam)
_, err := storagePool.AttachDevice(deviceParam)

for _, checkFn := range checkFns {
checkFn(t, err)
Expand Down
3 changes: 1 addition & 2 deletions fault_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package goscaleio

import (
"context"
"encoding/json"
"errors"
"math"
Expand Down Expand Up @@ -380,7 +379,7 @@ func TestGetFaultSetByName(t *testing.T) {
s := System{
client: client,
}
_, err = s.GetFaultSetByName(context.Background(), "mock-fault-set-name")
_, err = s.GetFaultSetByName("mock-fault-set-name")
if err != nil {
if tc.expectedErr.Error() != err.Error() {
t.Fatal(err)
Expand Down
13 changes: 6 additions & 7 deletions instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package goscaleio

import (
"context"
"encoding/json"
"fmt"
"math"
Expand Down Expand Up @@ -196,7 +195,7 @@ func TestGetInstance(t *testing.T) {
if err != nil {
t.Fatal(err)
}
_, err = client.GetInstance(context.Background(), tc.systemhref)
_, err = client.GetInstance(tc.systemhref)
if err != nil {
if tc.error != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -270,7 +269,7 @@ func TestGetVolume(t *testing.T) {
t.Fatal(err)
}

_, err = client.GetVolume(context.Background(), tc.volumehref, tc.volumeid, tc.ancestorevolumeid, tc.volumename, tc.snapshots)
_, err = client.GetVolume(tc.volumehref, tc.volumeid, tc.ancestorevolumeid, tc.volumename, tc.snapshots)
if err != nil {
if tc.error != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -306,7 +305,7 @@ func TestGetStoragePool(t *testing.T) {
t.Fatal(err)
}

_, err = client.GetStoragePool(context.Background(), tc.storagepoolhref)
_, err = client.GetStoragePool(tc.storagepoolhref)
if err != nil {
if tc.error != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -361,7 +360,7 @@ func TestFindStoragePool(t *testing.T) {
t.Fatal(err)
}

_, err = client.FindStoragePool(context.Background(), tc.poolid, tc.poolname, tc.storagepoolhref, tc.protectiondomainid)
_, err = client.FindStoragePool(tc.poolid, tc.poolname, tc.storagepoolhref, tc.protectiondomainid)
if err != nil {
if tc.error != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -397,7 +396,7 @@ func TestGetStoragePoolVolumes(t *testing.T) {
t.Fatal(err)
}

_, err = client.GetStoragePoolVolumes(context.Background(), tc.storagepoolid)
_, err = client.GetStoragePoolVolumes(tc.storagepoolid)
if err != nil {
if tc.error != err.Error() {
t.Fatal(err)
Expand Down Expand Up @@ -476,7 +475,7 @@ func TestGetSnapshotPolicyI(t *testing.T) {
t.Fatal(err)
}

_, err = client.GetSnapshotPolicy(context.Background(), tc.snapshotpolicyname, tc.snapshotpolicyid)
_, err = client.GetSnapshotPolicy(tc.snapshotpolicyname, tc.snapshotpolicyid)
if err != nil {
if tc.error != err.Error() {
t.Fatal(err)
Expand Down

0 comments on commit 97b4725

Please sign in to comment.