File: nodebalancer_types_test.go

package info (click to toggle)
golang-github-linode-linodego 1.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,112 kB
  • sloc: makefile: 96; sh: 52; python: 24
file content (40 lines) | stat: -rw-r--r-- 965 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package integration

import (
	"context"
	"testing"

	"github.com/linode/linodego"
	"github.com/stretchr/testify/require"
)

func TestNodeBalancerType_List(t *testing.T) {
	client, teardown := createTestClient(t, "fixtures/TestNodeBalancerType_List")
	defer teardown()

	nbTypes, err := client.ListNodeBalancerTypes(context.Background(), nil)
	require.NoError(t, err)
	require.Greater(t, len(nbTypes), 0)

	for _, nbType := range nbTypes {
		validateNodeBalancerType(t, nbType)
	}
}

func validateNodeBalancerType(
	t *testing.T,
	nbType linodego.NodeBalancerType,
) {
	require.NotEmpty(t, nbType.ID)
	require.NotEmpty(t, nbType.Label)

	require.Greater(t, nbType.Price.Hourly, 0.0)
	require.Greater(t, nbType.Price.Monthly, 0.0)
	require.GreaterOrEqual(t, nbType.Transfer, 0)

	for _, regionPrice := range nbType.RegionPrices {
		require.NotEmpty(t, regionPrice.ID)
		require.Greater(t, regionPrice.Hourly, 0.0)
		require.Greater(t, regionPrice.Monthly, 0.0)
	}
}