Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

ajeetdsouza/testcontainers-aerospike-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testcontainers-aerospike-go

Go Reference Go Report Card

Go library for Aerospike integration testing via Testcontainers.

Warning

This repo is archived. Please use the official Aerospike module instead.

Install

Use go get to install the latest version of the library.

go get -u github.com/ajeetdsouza/testcontainers-aerospike-go@latest

Usage

import (
    "context"
    "testing"

    "github.com/stretchr/testify/require"
    aero "github.com/aerospike/aerospike-client-go/v6"
    aeroTest "github.com/ajeetdsouza/testcontainers-aerospike-go"
)

func TestAerospike(t *testing.T) {
    aeroClient := setupAerospike(t)
    // your code here
}

func setupAerospike(t *testing.T) *aero.Client {
    ctx := context.Background()

    container, err := aeroTest.RunContainer(ctx)
    require.NoError(t, err)
    t.Cleanup(func() {
        err := container.Terminate(ctx)
        require.NoError(t, err)
    })

    host, err := container.Host(ctx)
    require.NoError(t, err)
    port, err := container.ServicePort(ctx)
    require.NoError(t, err)

    client, err := aero.NewClient(host, port)
    require.NoError(t, err)

    return client
}

Packages

 
 
 

Contributors

Languages