out * 1 hour
This commit is contained in:
@@ -37,7 +37,7 @@ func TestComputeResource_ConvertToPricedResource(t *testing.T) {
|
||||
|
||||
func TestComputeResourcePricingProfile_GetPriceHT_CPUs(t *testing.T) {
|
||||
start := time.Now()
|
||||
end := start.Add(1 * time.Hour)
|
||||
end := start.Add(5 * time.Minute)
|
||||
profile := resources.ComputeResourcePricingProfile{
|
||||
CPUsPrices: map[string]float64{"Xeon": 2.0},
|
||||
ExploitPricingProfile: pricing.ExploitPricingProfile[pricing.TimePricingStrategy]{
|
||||
@@ -61,7 +61,7 @@ func TestComputeResourcePricingProfile_GetPriceHT_InvalidParams(t *testing.T) {
|
||||
|
||||
func TestPricedComputeResource_GetPriceHT(t *testing.T) {
|
||||
start := time.Now()
|
||||
end := start.Add(1 * time.Hour)
|
||||
end := start.Add(5 * time.Minute)
|
||||
r := resources.PricedComputeResource{
|
||||
PricedResource: resources.PricedResource[*resources.ComputeResourcePricingProfile]{
|
||||
ResourceID: "comp456",
|
||||
|
||||
@@ -82,7 +82,7 @@ func TestDataResourcePricingProfile_IsPurchased(t *testing.T) {
|
||||
|
||||
func TestPricedDataResource_GetPriceHT(t *testing.T) {
|
||||
now := time.Now()
|
||||
later := now.Add(1 * time.Hour)
|
||||
later := now.Add(5 * time.Minute)
|
||||
mockPrice := 42.0
|
||||
|
||||
pricingProfile := &resources.DataResourcePricingProfile{AccessPricingProfile: pricing.AccessPricingProfile[resources.DataResourcePricingStrategy]{
|
||||
|
||||
@@ -64,7 +64,7 @@ func TestGetAndSetLocationStartEnd(t *testing.T) {
|
||||
|
||||
now := time.Now()
|
||||
r.SetLocationStart(now)
|
||||
r.SetLocationEnd(now.Add(2 * time.Hour))
|
||||
r.SetLocationEnd(now.Add(10 * time.Minute))
|
||||
|
||||
assert.Equal(t, now, *r.GetLocationStart())
|
||||
assert.Equal(t, now.Add(2*time.Hour), *r.GetLocationEnd())
|
||||
@@ -81,7 +81,7 @@ func TestGetExplicitDurationInS(t *testing.T) {
|
||||
|
||||
t.Run("computes duration from start and end", func(t *testing.T) {
|
||||
start := time.Now()
|
||||
end := start.Add(2 * time.Hour)
|
||||
end := start.Add(10 * time.Minute)
|
||||
r := &resources.PricedResource[pricing.PricingProfileITF]{
|
||||
BookingConfiguration: &resources.BookingConfiguration{
|
||||
UsageStart: &start, UsageEnd: &end,
|
||||
@@ -117,7 +117,7 @@ func TestGetPriceHT(t *testing.T) {
|
||||
|
||||
t.Run("returns error if profile GetPriceHT fails", func(t *testing.T) {
|
||||
start := time.Now()
|
||||
end := start.Add(1 * time.Hour)
|
||||
end := start.Add(5 * time.Minute)
|
||||
mock := &MockPricingProfile{ReturnErr: true}
|
||||
r := &resources.PricedResource[pricing.PricingProfileITF]{
|
||||
SelectedPricing: mock,
|
||||
@@ -133,7 +133,7 @@ func TestGetPriceHT(t *testing.T) {
|
||||
|
||||
t.Run("uses SelectedPricing if set", func(t *testing.T) {
|
||||
start := time.Now()
|
||||
end := start.Add(1 * time.Hour)
|
||||
end := start.Add(5 * time.Minute)
|
||||
mock := &MockPricingProfile{ReturnCost: 10.0}
|
||||
r := &resources.PricedResource[pricing.PricingProfileITF]{
|
||||
SelectedPricing: mock,
|
||||
|
||||
@@ -23,7 +23,7 @@ func TestPricedProcessingResource_GetType(t *testing.T) {
|
||||
|
||||
func TestPricedProcessingResource_GetExplicitDurationInS(t *testing.T) {
|
||||
now := time.Now()
|
||||
after := now.Add(2 * time.Hour)
|
||||
after := now.Add(10 * time.Minute)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -46,7 +46,7 @@ func TestPricedProcessingResource_GetExplicitDurationInS(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: float64((1 * time.Hour).Seconds()),
|
||||
expected: float64((5 * time.Minute).Seconds()),
|
||||
},
|
||||
{
|
||||
name: "Duration computed from start and end",
|
||||
@@ -58,7 +58,7 @@ func TestPricedProcessingResource_GetExplicitDurationInS(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: float64((2 * time.Hour).Seconds()),
|
||||
expected: float64((10 * time.Minute).Seconds()),
|
||||
},
|
||||
{
|
||||
name: "Explicit duration takes precedence",
|
||||
@@ -89,7 +89,7 @@ func TestProcessingResource_GetAccessor(t *testing.T) {
|
||||
|
||||
func TestProcessingResourcePricingProfile_GetPriceHT(t *testing.T) {
|
||||
start := time.Now()
|
||||
end := start.Add(2 * time.Hour)
|
||||
end := start.Add(10 * time.Minute)
|
||||
mockPricing := pricing.AccessPricingProfile[pricing.TimePricingStrategy]{
|
||||
Pricing: pricing.PricingStrategy[pricing.TimePricingStrategy]{
|
||||
Price: 100.0,
|
||||
|
||||
Reference in New Issue
Block a user