generated from vshn/go-bootstrap
-
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
Gabriel Saratura
committed
Apr 30, 2024
1 parent
5539f19
commit 5686ae1
Showing
2 changed files
with
55 additions
and
2 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
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,37 @@ | ||
package exoscale | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestObjectStorage_getProductId(t *testing.T) { | ||
tests := map[string]struct { | ||
value float64 // in GiB | ||
expectTier string | ||
}{ | ||
"given SOS with below 512TiB capacity, we should get the Product Tier 1": { | ||
value: 300.1, // in GiB | ||
expectTier: productIdStorageTier1, | ||
}, | ||
"given SOS with above 512 TiB and below 1Pib capacity, we should get the Product Tier 2": { | ||
value: 813000.4, // in GiB | ||
expectTier: productIdStorageTier2, | ||
}, | ||
"given SOS with above 1Pib capacity, we should get the Product Tier 3": { | ||
value: 1300345.6, // in GiB | ||
expectTier: productIdStorageTier3, | ||
}, | ||
"given SOS with below 0 capacity, we should get the Product Tier 1": { | ||
value: 0, // in GiB | ||
expectTier: productIdStorageTier1, | ||
}, | ||
} | ||
|
||
for name, tc := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
tier := getProductId(tc.value) | ||
assert.Equal(t, tc.expectTier, tier) | ||
}) | ||
} | ||
} |