-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
integration: V3 grpc with clientv3 (only Put) #4336
Conversation
@heyitsanthony If you haven't worked on integration test on clientv3, can I work on it? /cc @xiang90 |
kvc := clus.RandClient().KV | ||
key := []byte("foo") | ||
reqput := &pb.PutRequest{Key: key, Value: []byte("bar")} | ||
if !useClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably be separate functions instead of one big if/else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok will try to wrap it.
one last bit--- |
we should move this to clientv3/integration as I mentioned here #4332 (comment). We should try our best to not introduce external dependency in our server tests. |
@xiang90 Ok I will put these to the separate directory. Thanks |
@heyitsanthony @xiang90 Just separated. PTAL. Thanks! |
// limitations under the License. | ||
|
||
/* | ||
Package integration implements tests built upon embedded etcd, and focus on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not seem correct. this is inside client pkg. we want to test the correctness of client, not etcd.
@gyuho Let's start with the simple test |
t.Fatalf("couldn't put key (%v)", err) | ||
} | ||
|
||
resprange, err := kvc.Range(key, "", 0, 0, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use get.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@xiang90 Agree. This should be testing only clients. Just cleaned up to have |
} | ||
|
||
if !bytes.Equal([]byte(val), resprange.Kvs[0].Value) { | ||
t.Errorf("expected value baz, got %s", resprange.Kvs[0].Value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.errorf(val = %s, want %s)
LGTM after fixing the last few comments. Then we can test KVGet, KVRange, KVDelete, KVDeleteRange. |
|
||
func TestKVPut(t *testing.T) { | ||
defer testutil.AfterTest(t) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first create a lease with very long ttl here.
if err != nil { | ||
t.Fatalf("couldn't lease (%v)", err) | ||
} | ||
leaseID := lease.LeaseID(lresp.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I create lease here this way, since lease part hasn't been implemented yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea... i would suggest just leave this as a todo instead of using some half-baked stuff in server side.
7d2e0b8
to
7463307
Compare
} | ||
if tt.leaseID != lease.LeaseID(resp.Kvs[0].Lease) { | ||
t.Errorf("#%d: val = %d, want %d", i, tt.leaseID, resp.Kvs[0].Lease) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xiang90 Just added lease id check here and TODO: create lease from client side
above. PTAL.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean just remove the lease create stuff and comment out the second test case. Thanks!
4f8b351
to
ff599be
Compare
Thanks. Just fixed and updated test script to run integration test in clientv3. Will write tests for |
LGTM if test passes |
integration: V3 grpc with clientv3 (only Put)
Thanks |
No description provided.