mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 13:12:20 +00:00
Make ResourceVersion a string internally instead of uint64
Allows us to define different watch versioning regimes in the future as well as to encode information with the resource version. This changes /watch/resources?resourceVersion=3 to start the watch at 4 instead of 3, which means clients can read a resource version and then send it back to the server. Clients should no longer do math on resource versions.
This commit is contained in:
@@ -19,6 +19,7 @@ limitations under the License.
|
||||
package integration
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
@@ -92,7 +93,7 @@ func TestExtractObj(t *testing.T) {
|
||||
|
||||
func TestWatch(t *testing.T) {
|
||||
client := newEtcdClient()
|
||||
helper := tools.EtcdHelper{Client: client, Codec: latest.Codec, ResourceVersioner: latest.ResourceVersioner}
|
||||
helper := tools.EtcdHelper{Client: client, Codec: latest.Codec, ResourceVersioner: tools.RuntimeVersionAdapter{latest.ResourceVersioner}}
|
||||
withEtcdKey(func(key string) {
|
||||
resp, err := client.Set(key, runtime.EncodeOrDie(v1beta1.Codec, &api.Pod{TypeMeta: api.TypeMeta{ID: "foo"}}), 0)
|
||||
if err != nil {
|
||||
@@ -109,7 +110,7 @@ func TestWatch(t *testing.T) {
|
||||
|
||||
// version should match what we set
|
||||
pod := event.Object.(*api.Pod)
|
||||
if pod.ResourceVersion != expectedVersion {
|
||||
if pod.ResourceVersion != strconv.FormatUint(expectedVersion, 10) {
|
||||
t.Errorf("expected version %d, got %#v", expectedVersion, pod)
|
||||
}
|
||||
|
||||
@@ -134,7 +135,7 @@ func TestWatch(t *testing.T) {
|
||||
t.Errorf("expected deleted event %#v", event)
|
||||
}
|
||||
pod = event.Object.(*api.Pod)
|
||||
if pod.ResourceVersion != expectedVersion {
|
||||
if pod.ResourceVersion != strconv.FormatUint(expectedVersion, 10) {
|
||||
t.Errorf("expected version %d, got %#v", expectedVersion, pod)
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user