2022-03-22 11:03:15 -04:00
|
|
|
package resources
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAutoscalerDeploymentMarshalUnmarshal(t *testing.T) {
|
|
|
|
require := require.New(t)
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
2022-03-29 07:25:04 -04:00
|
|
|
autoscalerDepl := NewDefaultAutoscalerDeployment(nil, nil, nil)
|
2022-03-22 11:03:15 -04:00
|
|
|
|
|
|
|
data, err := autoscalerDepl.Marshal()
|
|
|
|
require.NoError(err)
|
|
|
|
|
|
|
|
t.Log(string(data))
|
|
|
|
|
|
|
|
var recreated autoscalerDeployment
|
|
|
|
require.NoError(UnmarshalK8SResources(data, &recreated))
|
|
|
|
assert.Equal(autoscalerDepl, &recreated)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAutoscalerDeploymentWithCommandMarshalUnmarshal(t *testing.T) {
|
|
|
|
require := require.New(t)
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
2022-03-29 07:25:04 -04:00
|
|
|
autoscalerDepl := NewDefaultAutoscalerDeployment(nil, nil, nil)
|
2022-03-22 11:03:15 -04:00
|
|
|
autoscalerDepl.SetAutoscalerCommand("someProvider", []string{"group1", "group2"})
|
|
|
|
|
|
|
|
data, err := autoscalerDepl.Marshal()
|
|
|
|
require.NoError(err)
|
|
|
|
|
|
|
|
t.Log(string(data))
|
|
|
|
|
|
|
|
var recreated autoscalerDeployment
|
|
|
|
require.NoError(UnmarshalK8SResources(data, &recreated))
|
|
|
|
assert.Equal(autoscalerDepl, &recreated)
|
|
|
|
}
|