Beispiel #1
0
func TestAvailLinodePlansIntegration(t *testing.T) {
	c := NewClient(apiKey)

	plans, err := c.AvailLinodePlans(nil)
	require.NoError(t, err)
	require.NotEmpty(t, plans)

	testPlanNotEmpty(t, plans)

	// Spot check
	plans, err = c.AvailLinodePlans(Int(1))
	require.NoError(t, err)
	require.Len(t, plans, 1)

	p := plans[0]

	assert.Equal(t, 1, p.Cores)
	assert.Equal(t, 10.00, p.Price)
	assert.Equal(t, 1024, p.RAM)
	assert.Equal(t, 2000, p.Xfer)
	assert.Equal(t, 1, p.ID)
	assert.Equal(t, "Linode 1024", p.Label)
	assert.Equal(t, 24, p.Disk)
	assert.Equal(t, 0.015, p.Hourly)

	plans, err = c.AvailLinodePlans(Int(3498230))
	require.NoError(t, err)
	require.Empty(t, plans)
}
Beispiel #2
0
func TestAvailDistributionsEmpty(t *testing.T) {
	c, ts := clientFor(newMockAPIServer(t, mockAvailDistributionsEmpty()))
	defer ts.Close()

	dists, err := c.AvailDistributions(Int(38201938))
	require.NoError(t, err)
	require.Empty(t, dists)
}
Beispiel #3
0
func TestAvailStackScriptsIntegration(t *testing.T) {
	c := NewClient(apiKey)

	sscripts, err := c.AvailStackScripts(nil, nil, nil)
	require.NoError(t, err)
	require.NotEmpty(t, sscripts)

	testSSNotEmpty(t, sscripts)

	sscripts, err = c.AvailStackScripts(Int(3133731337), String("bar"), String("baz"))
	require.NoError(t, err)
	require.Empty(t, sscripts)
}
Beispiel #4
0
func TestAvailKernelsIntegration(t *testing.T) {
	c := NewClient(apiKey)

	kerns, err := c.AvailKernels(nil, nil)
	require.NoError(t, err)
	require.NotEmpty(t, kerns)

	var everXen bool
	var everPVOps bool

	for _, k := range kerns {
		if k.IsXen {
			everXen = true
		}
		if k.IsPVOps {
			everPVOps = true
		}
		assert.NotEmpty(t, k.Label, "k.Label")
		assert.NotEmpty(t, k.ID, "k.ID")
	}
	assert.True(t, everXen, "everXen")
	assert.True(t, everPVOps, "everPVOps")

	kerns, err = c.AvailKernels(Int(138), Bool(true))
	require.NoError(t, err)
	require.Len(t, kerns, 1)

	k := kerns[0]

	assert.True(t, k.IsXen)
	assert.True(t, k.IsPVOps)
	assert.NotEmpty(t, k.ID)
	assert.NotEmpty(t, k.Label)

	kerns, err = c.AvailKernels(Int(4389048234), Bool(false))
	require.NoError(t, err)
	require.Empty(t, kerns)
}