K8s/Unified: Consolidate generation logic in apistore client (#102260)
This commit is contained in:
@@ -4,12 +4,13 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/apiserver/registry/generic"
|
||||
"github.com/stretchr/testify/require"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apiserver/pkg/apis/example"
|
||||
|
||||
"github.com/grafana/grafana/pkg/apiserver/registry/generic"
|
||||
)
|
||||
|
||||
func TestPrepareForUpdate(t *testing.T) {
|
||||
@@ -69,37 +70,6 @@ func TestPrepareForUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "increment generation if spec changes",
|
||||
newObj: &example.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
Namespace: "default",
|
||||
Generation: 1,
|
||||
},
|
||||
Spec: example.PodSpec{
|
||||
NodeSelector: map[string]string{"foo": "baz"},
|
||||
},
|
||||
Status: example.PodStatus{
|
||||
Phase: example.PodPhase("Running"),
|
||||
},
|
||||
},
|
||||
oldObj: oldObj.DeepCopy(),
|
||||
expectedGen: 2,
|
||||
expectedObj: &example.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test",
|
||||
Namespace: "default",
|
||||
Generation: 2,
|
||||
},
|
||||
Spec: example.PodSpec{
|
||||
NodeSelector: map[string]string{"foo": "baz"},
|
||||
},
|
||||
Status: example.PodStatus{
|
||||
Phase: example.PodPhase("Running"),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user