Commit 006bf887 authored by Zhu Yong's avatar Zhu Yong Committed by GitHub
Browse files

Merge pull request #5 from yongzhy/master

Add travis-ci build configuration
parents 063637f8 96161b0c
Loading
Loading
Loading
Loading

.travis.yml

0 → 100755
+19 −0
Original line number Diff line number Diff line
language: go

go:
  - 1.4
  - 1.5
  - 1.6
  - 1.7
  - master

before_install:
  - git clone https://github.com/Kinetic/kinetic-java.git ~/kinetic-java
  - pushd ~/kinetic-java && mvn clean package && popd
  - ( ~/kinetic-java/bin/startSimulator.sh& ) 
  - sleep 5

install:
  - go get github.com/Kinetic/kinetic-go

script: go test ./...

README.md

100644 → 100755
+6 −0
Original line number Diff line number Diff line
# Kinetic-Go 

[![Build Status](https://travis-ci.org/Kinetic/kinetic-go.svg?branch=master)](https://travis-ci.org/Kinetic/kinetic-go)

## Introduction

Kinetic client library in Golang. 
@@ -10,11 +12,15 @@ This client is using version `3.0.6` from [Kinetic-Protocol](https://github.com/

## Installation

Install with following command:

    go get github.com/Kinetic/kinetic-go 

## Usage

Refer to file `kinetic_test.go` and `connection_test.go` for some examples.

More examples can be found in [kinetic-go-examples](https://github.com/yongzhy/kinetic-go-examples) repository.

## License

+14 −7
Original line number Diff line number Diff line
@@ -58,28 +58,32 @@ func TestBlockNoOp(t *testing.T) {

func TestBlockGet(t *testing.T) {
	_, status, err := blockConn.Get([]byte("object000"))
	if err != nil || status.Code != OK {
	// Object might not exist, expect to see OK status, or REMOTE_NOT_FOUND
	if err != nil || (status.Code != OK && status.Code != REMOTE_NOT_FOUND) {
		t.Fatal("Blocking Get Failure", err, status.String())
	}
}

func TestBlockGetNext(t *testing.T) {
	_, status, err := blockConn.GetNext([]byte("object000"))
	if err != nil || status.Code != OK {
	// Object might not exist, expect to see OK status, or REMOTE_NOT_FOUND
	if err != nil || (status.Code != OK && status.Code != REMOTE_NOT_FOUND) {
		t.Fatal("Blocking GetNext Failure", err, status.String())
	}
}

func TestBlockGetPrevious(t *testing.T) {
	_, status, err := blockConn.GetPrevious([]byte("object000"))
	if err != nil || status.Code != OK {
	// Object might not exist, expect to see OK status, or REMOTE_NOT_FOUND
	if err != nil || (status.Code != OK && status.Code != REMOTE_NOT_FOUND) {
		t.Fatal("Blocking GetPrevious Failure", err, status.String())
	}
}

func TestBlockGetVersion(t *testing.T) {
	version, status, err := blockConn.GetVersion([]byte("object000"))
	if err != nil || status.Code != OK {
	// Object might not exist, expect to see OK status, or REMOTE_NOT_FOUND
	if err != nil || (status.Code != OK && status.Code != REMOTE_NOT_FOUND) {
		t.Fatal("Blocking GetVersion Failure", err, status.String())
	}
	t.Logf("Object version = %x", version)
@@ -119,7 +123,8 @@ func TestBlockPut_keyOverflow(t *testing.T) {
		Force: true,
	}
	status, err := blockConn.Put(&entry)
	if err != nil || status.Code != OK {
	// Request with key buffer overflow, expect to see failure code REMOTE_INVALID_REQUEST
	if err != nil || status.Code != REMOTE_INVALID_REQUEST {
		t.Fatal("Blocking Put Failure", err, status.String())
	}
}
@@ -136,7 +141,8 @@ func TestBlockPut_valueOverflow(t *testing.T) {
		Force: true,
	}
	status, err := blockConn.Put(&entry)
	if err != nil || status.Code != OK {
	// Request with value buffer overflow, expect to see failure code REMOTE_INVALID_REQUEST
	if err != nil || status.Code != REMOTE_INVALID_REQUEST {
		t.Fatal("Blocking Put Failure", err, status.String())
	}
}
@@ -153,7 +159,8 @@ func TestBlockPut_tagOverflow(t *testing.T) {
		Force: true,
	}
	status, err := blockConn.Put(&entry)
	if err != nil || status.Code != OK {
	// Request with tag buffer overflow, expect to see failure code REMOTE_INVALID_REQUEST
	if err != nil || status.Code != REMOTE_INVALID_REQUEST {
		t.Fatal("Blocking Put Failure", err, status.String())
	}
}