1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
14 func Test(t *testing.T) { TestingT(t) }
16 type cloudSuite struct{}
18 var _ = Suite(&cloudSuite{})
20 func (s *cloudSuite) TestNormalizePriceHistory(c *C) {
21 t0, err := time.Parse(time.RFC3339, "2023-01-01T01:00:00Z")
24 {t0.Add(1 * time.Minute), 1.0},
25 {t0.Add(4 * time.Minute), 1.2}, // drop: unchanged price
26 {t0.Add(5 * time.Minute), 1.1},
27 {t0.Add(3 * time.Minute), 1.2},
28 {t0.Add(5 * time.Minute), 1.1}, // drop: duplicate
29 {t0.Add(2 * time.Minute), 1.0}, // drop: out of order, unchanged price
31 c.Check(NormalizePriceHistory(h), DeepEquals, []InstancePrice{h[2], h[3], h[0]})