Official golang SDK for Kuzzle
Clone or download
alexandrebouthinon and scottinet [KZL-489] Multistage / multiarch test (#204)
* [KZL-489] Multistage build

* [KZL-489] Fix tests

Fix ms.pexpireAt and server.now tests to fit
32bits requirments
Latest commit 7ea08a0 Sep 24, 2018

README.md

Build Status codecov.io GoDoc Go Report Card

Official Kuzzle GO SDK with wrappers for C++ and JAVA SDK

About Kuzzle

A backend software, self-hostable and ready to use to power modern apps.

You can access the Kuzzle repository on Github

SDK Documentation

The complete SDK documentation is available here

Installation

go get github.com/kuzzleio/sdk-go

Basic usage

func main() {
    conn := websocket.NewWebSocket("localhost:7512", nil)
    k, _ := kuzzle.NewKuzzle(conn, nil)

    res, err := k.GetAllStatistics(nil)

    if err != nil {
        fmt.Println(err.Error())
        return
    }

    for _, stat := range res {
        fmt.Println(stat.Timestamp, stat.FailedRequests, stat.Connections, stat.CompletedRequests, stat.OngoingRequests)
    }
}

Running Tests

### Unit tests

To run the tests you can simply execute the coverage.sh script

./test.sh

You can also get html coverage by running

./test.sh --html

### e2e tests

JAVA

cd internal/wrappers
make java
cd features/java
gradle cucumber

C++

make cpp
cd internal/wrappers
./build_cpp_tests.sh̀
./_build_cpp_tests/KuzzleSDKStepDefs > /dev/null &
cucumber

Wrappers

### Dependencies

Before generating the wrappers you will need to install:

  • You will need a g++ compatible C++11
  • swig
  • Java 8 (don't forget to set your JAVA_HOME environment variable)
  • Python You will need to install python-dev to compile the python SDK

Generate

JAVA

make java

You will find the final jars files in internal/wrappers/build/java/build/libs

CPP

make cpp

You will find the final .so file in internal/wrappers/build/cpp

Python

make python

You will find the final .so file in internal/wrappers/build/python

CSHARP

Build on Windows

Prerequisites

Compiling Csharp

  • Add Go/Mono/Make/MinGW intallation directory to PATH
  • Run Visual Studio developper command line tool
  • Execute make csharp

All at once

You can generate all sdk's at once by typing

make all

Generate wrappers and launch e2e tests using Docker

You can use Docker to simplify wrappers generation and testing

Build

In project root, use:

$ docker run --rm -it -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /build.sh

This command will build all wrappers using our Docker Image

Testing

E2E tests need a running Kuzzle instance so run the script:

$ sh .codepipeline/start_kuzzle.sh

Now run tests using Docker:

$ docker run --rm -it --network codepipeline_default --link kuzzle -v "$(pwd)":/go/src/github.com/kuzzleio/sdk-go kuzzleio/sdk-cross:amd64 /test.sh

License

Apache 2