Initial version

Project structure, api, discovery service, docker.
This commit is contained in:
2023-12-06 08:29:05 +03:00
commit 7864272baa
19 changed files with 896 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
package discovery
import (
"context"
"os"
"os/signal"
"sync"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/zap/zaptest"
)
func TestIface(t *testing.T) {
ctx, cancel := signal.NotifyContext(context.Background(), os.Kill, os.Interrupt)
t.Cleanup(cancel)
ctx, _ = context.WithTimeout(ctx, time.Second*5)
set, err := NewDiscoverySet(zaptest.NewLogger(t).Named("discovery"), 1234, WithDebug())
require.NoError(t, err)
wg := sync.WaitGroup{}
wg.Add(1)
go set[0].Start(ctx, &wg)
go func() {
for {
time.Sleep(time.Second)
}
}()
wg.Wait()
assert.Len(t, set[0].Nodes(), 1)
}