From c6d5fafa7d6d5eb55b33b631148faa5a889d5f32 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Thu, 29 Jun 2023 22:36:26 +0200 Subject: [PATCH] start working on client component --- client/client.go | 15 +++++++++++++++ tests/etc/etc.go | 9 ++++++++- tests/scopes_test.go | 4 ++-- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 client/client.go diff --git a/client/client.go b/client/client.go new file mode 100644 index 0000000..63b7d2b --- /dev/null +++ b/client/client.go @@ -0,0 +1,15 @@ +package client + +import ( + "git.sr.ht/~cco/go-scopes/config" + "git.sr.ht/~cco/go-scopes/lib" +) + +type Cfg struct { + *config.BaseCfg + Url string +} + +func Send(act lib.Action) bool { + return true +} diff --git a/tests/etc/etc.go b/tests/etc/etc.go index a0da576..998baae 100644 --- a/tests/etc/etc.go +++ b/tests/etc/etc.go @@ -2,6 +2,7 @@ package etc import ( "git.sr.ht/~cco/go-scopes/app" + "git.sr.ht/~cco/go-scopes/client" "git.sr.ht/~cco/go-scopes/config" "git.sr.ht/~cco/go-scopes/lib" "git.sr.ht/~cco/go-scopes/lib/action" @@ -36,10 +37,15 @@ func Config() lib.Config { Port: ovr("8123", SERVER_PORT), } + test_client := &client.Cfg{ + BaseCfg: b("test-client", core.Start), + Url: ovr("http://localhost:8123", SERVER_URL), + } + test_rcvr := b("test-receiver", core.Start). AddAction("demo", action.Base(AH_Receiver)) - app_c.Add(config_c, server_c, test_rcvr) + app_c.Add(config_c, server_c, test_client, test_rcvr) return app_c } @@ -56,6 +62,7 @@ const ( LOGFILE = "logfile" LOGLEVEL = "loglevel" SERVER_PORT = "server_port" + SERVER_URL = "server_url" ) // in a production scenario this should be put in a separate diff --git a/tests/scopes_test.go b/tests/scopes_test.go index 7c02751..ed339f6 100644 --- a/tests/scopes_test.go +++ b/tests/scopes_test.go @@ -18,12 +18,12 @@ func TestConfig(tb *tbase.T) { t.Run("config", ConfigTest) t.Run("send", SendTest) t.TearDownApp() - t.AssertEqual(t.LogCount(true), 7) + t.AssertEqual(t.LogCount(true), 8) } func AppTest(t *testing.T) { ctx := t.Ctx - t.AssertEqual(len(ctx.Services()), 4) + t.AssertEqual(len(ctx.Services()), 5) } func ConfigTest(t *testing.T) {