From 9211537e55faa63a44bbd7a6ee893bcc09dd8958 Mon Sep 17 00:00:00 2001 From: samyfodil Date: Fri, 28 Jul 2023 04:21:44 -0500 Subject: [PATCH 1/4] first pass --- service/api/api.go | 55 +++++++++++++++++++----------- service/api/cors_http.go | 4 +-- service/api/helpers.go | 6 ++-- service/api/http_routes.go | 39 ++++++++++++--------- service/api/id_http.go | 32 ++++++++--------- service/api/inject_fixture.go | 14 ++++---- service/api/inject_service.go | 10 +++--- service/api/inject_simple.go | 10 +++--- service/api/inject_universe.go | 12 +++---- service/api/kill_node_by_id.go | 10 +++--- service/api/kill_service.go | 12 +++---- service/api/kill_simple.go | 10 +++--- service/api/kill_universe.go | 12 +++---- service/api/les_miserables_http.go | 12 +++---- service/api/ping.go | 14 ++++++++ service/api/status_http.go | 14 ++++---- service/api/valid_clients.go | 14 ++++---- service/api/valid_fixtures.go | 14 ++++---- service/api/valid_services.go | 14 ++++---- 19 files changed, 166 insertions(+), 142 deletions(-) create mode 100644 service/api/ping.go diff --git a/service/api/api.go b/service/api/api.go index 4fbc44f..330afd1 100644 --- a/service/api/api.go +++ b/service/api/api.go @@ -1,8 +1,12 @@ package api import ( + "context" "time" + goHttp "net/http" + + "github.com/pterm/pterm" httpIface "github.com/taubyte/http" http "github.com/taubyte/http/basic" "github.com/taubyte/http/options" @@ -10,31 +14,42 @@ import ( "github.com/taubyte/tau/libdream/services" ) -var serviceApi httpIface.Service -var mv common.Multiverse +type multiverseService struct { + rest httpIface.Service + common.Multiverse +} func BigBang() error { - err := Start(services.NewMultiVerse()) - if err != nil { - return err + var err error + + srv := &multiverseService{ + Multiverse: services.NewMultiVerse(), } - return nil -} -func Start(m common.Multiverse) (err error) { - mv = m - serviceApi, err = http.New(m.Context(), options.Listen(common.DreamlandApiListen), options.AllowedOrigins(true, []string{".*"})) + srv.rest, err = http.New(srv.Context(), options.Listen(common.DreamlandApiListen), options.AllowedOrigins(true, []string{".*"})) if err != nil { - return + return err } - setUpHttpRoutes() - - serviceApi.Start() - - time.Sleep(300 * time.Millisecond) - - err = serviceApi.Error() - - return + srv.setUpHttpRoutes().Start() + + waitCtx, waitCtxC := context.WithTimeout(srv.Context(), 10*time.Second) + defer waitCtxC() + + for { + select { + case <-waitCtx.Done(): + return waitCtx.Err() + case <-time.After(100 * time.Millisecond): + if srv.rest.Error() != nil { + pterm.Error.Println("Dreamland failed to start") + return srv.rest.Error() + } + _, err := goHttp.Get("http://" + common.DreamlandApiListen) + if err == nil { + pterm.Info.Println("Dreamland ready") + return nil + } + } + } } diff --git a/service/api/cors_http.go b/service/api/cors_http.go index 1a8b267..c7d65f2 100644 --- a/service/api/cors_http.go +++ b/service/api/cors_http.go @@ -7,8 +7,8 @@ import ( httpIface "github.com/taubyte/http" ) -func corsHttp() { - serviceApi.LowLevel(&httpIface.LowLevelDefinition{ +func (srv *multiverseService) corsHttp() { + srv.rest.LowLevel(&httpIface.LowLevelDefinition{ Path: "/cors", Handler: func(w http.ResponseWriter, r *http.Request) { cors.ProxyHandler(w, r) diff --git a/service/api/helpers.go b/service/api/helpers.go index ca1bda6..3ef9e2b 100644 --- a/service/api/helpers.go +++ b/service/api/helpers.go @@ -7,15 +7,15 @@ import ( "github.com/taubyte/tau/libdream/common" ) -func getUniverse(ctx httpIface.Context) (common.Universe, error) { +func (srv *multiverseService) getUniverse(ctx httpIface.Context) (common.Universe, error) { name, err := ctx.GetStringVariable("universe") if err != nil { return nil, fmt.Errorf("failed getting name with: %w", err) } - exist := mv.Exist(name) + exist := srv.Exist(name) if exist { - return mv.Universe(name), nil + return srv.Universe(name), nil } else { return nil, fmt.Errorf("universe %s does not exist", name) } diff --git a/service/api/http_routes.go b/service/api/http_routes.go index bd0fb16..4b046fc 100644 --- a/service/api/http_routes.go +++ b/service/api/http_routes.go @@ -1,26 +1,33 @@ package api -func setUpHttpRoutes() { - corsHttp() +import httpIface "github.com/taubyte/http" - statusHttp() - lesMiesrablesHttp() - fixtureHttp() - idHttp() +func (srv *multiverseService) setUpHttpRoutes() httpIface.Service { + srv.corsHttp() + + srv.statusHttp() + srv.lesMiesrablesHttp() + srv.fixtureHttp() + srv.idHttp() // Inject - injectSimpleHttp() - injectServiceHttp() - injectUniverseHttp() + srv.injectSimpleHttp() + srv.injectServiceHttp() + srv.injectUniverseHttp() // Kill - killServiceHttp() - killSimpleHttp() - killNodeIdHttp() - killUniverseHttp() + srv.killServiceHttp() + srv.killSimpleHttp() + srv.killNodeIdHttp() + srv.killUniverseHttp() // Get - validClients() - validServices() - validFixtures() + srv.validClients() + srv.validServices() + srv.validFixtures() + + //ping + srv.pingHttp() + + return srv.rest } diff --git a/service/api/id_http.go b/service/api/id_http.go index 6a13822..4243589 100644 --- a/service/api/id_http.go +++ b/service/api/id_http.go @@ -10,27 +10,25 @@ type UniverseInfo struct { Id string `json:"id"` } -func idHttp() { - serviceApi.GET(&httpIface.RouteDefinition{ +func (srv *multiverseService) idHttp() { + srv.rest.GET(&httpIface.RouteDefinition{ Path: "/id/{universe}", Vars: httpIface.Variables{ Required: []string{"universe"}, }, - Handler: apiHandlerId, - }) -} - -func apiHandlerId(ctx httpIface.Context) (interface{}, error) { - universeName, err := ctx.GetStringVariable("universe") - if err != nil { - return nil, err - } + Handler: func(ctx httpIface.Context) (interface{}, error) { + universeName, err := ctx.GetStringVariable("universe") + if err != nil { + return nil, err + } - exists := mv.Exist(universeName) - if !exists { - return nil, fmt.Errorf("universe `%s` does not exit", universeName) - } + exists := srv.Exist(universeName) + if !exists { + return nil, fmt.Errorf("universe `%s` does not exit", universeName) + } - u := mv.Universe(universeName) - return UniverseInfo{Id: u.Id()}, nil + u := srv.Universe(universeName) + return UniverseInfo{Id: u.Id()}, nil + }, + }) } diff --git a/service/api/inject_fixture.go b/service/api/inject_fixture.go index 2a5df6c..d82b72f 100644 --- a/service/api/inject_fixture.go +++ b/service/api/inject_fixture.go @@ -8,17 +8,17 @@ import ( "github.com/taubyte/tau/libdream/common" ) -func fixtureHttp() { - serviceApi.POST(&httpIface.RouteDefinition{ +func (srv *multiverseService) fixtureHttp() { + srv.rest.POST(&httpIface.RouteDefinition{ Path: "/fixture/{universe}/{fixture}", Vars: httpIface.Variables{ Required: []string{"universe", "fixture", "params"}, }, - Handler: apiHandlerFixture, + Handler: srv.apiHandlerFixture, }) } -func apiHandlerFixture(ctx httpIface.Context) (interface{}, error) { +func (srv *multiverseService) apiHandlerFixture(ctx httpIface.Context) (interface{}, error) { // Grab fixture to run fixture, err := ctx.GetStringVariable("fixture") if err != nil { @@ -26,7 +26,7 @@ func apiHandlerFixture(ctx httpIface.Context) (interface{}, error) { } var found bool - fixtures := mv.ValidFixtures() + fixtures := srv.ValidFixtures() for _, _fixture := range fixtures { if fixture == _fixture { found = true @@ -43,9 +43,9 @@ func apiHandlerFixture(ctx httpIface.Context) (interface{}, error) { return nil, fmt.Errorf("failed getting universe name error %w", err) } - exist := mv.Exist(_name) + exist := srv.Exist(_name) if exist { - universe = mv.Universe(_name) + universe = srv.Universe(_name) } else { return nil, fmt.Errorf("universe %s does not exist", _name) } diff --git a/service/api/inject_service.go b/service/api/inject_service.go index 8c51477..5c793ac 100644 --- a/service/api/inject_service.go +++ b/service/api/inject_service.go @@ -7,20 +7,20 @@ import ( httpIface "github.com/taubyte/http" ) -func injectServiceHttp() { +func (srv *multiverseService) injectServiceHttp() { // Path to create services in a universe - serviceApi.POST(&httpIface.RouteDefinition{ + srv.rest.POST(&httpIface.RouteDefinition{ Path: "/service/{universe}/{name}", Vars: httpIface.Variables{ Required: []string{"universe", "name", "config"}, }, - Handler: apiHandlerService, + Handler: srv.apiHandlerService, }) } -func apiHandlerService(ctx httpIface.Context) (interface{}, error) { +func (srv *multiverseService) apiHandlerService(ctx httpIface.Context) (interface{}, error) { // Grab the universe - universe, err := getUniverse(ctx) + universe, err := srv.getUniverse(ctx) if err != nil { return nil, fmt.Errorf("killing service failed with: %s", err.Error()) } diff --git a/service/api/inject_simple.go b/service/api/inject_simple.go index 0500b85..c50244b 100644 --- a/service/api/inject_simple.go +++ b/service/api/inject_simple.go @@ -7,20 +7,20 @@ import ( "github.com/taubyte/tau/libdream/common" ) -func injectSimpleHttp() { +func (srv *multiverseService) injectSimpleHttp() { // Path to create simples in a universe - serviceApi.POST(&httpIface.RouteDefinition{ + srv.rest.POST(&httpIface.RouteDefinition{ Path: "/simple/{universe}/{name}", Vars: httpIface.Variables{ Required: []string{"universe", "name", "config"}, }, - Handler: apiHandlerSimple, + Handler: srv.apiHandlerSimple, }) } -func apiHandlerSimple(ctx httpIface.Context) (interface{}, error) { +func (srv *multiverseService) apiHandlerSimple(ctx httpIface.Context) (interface{}, error) { // Grab the universe - universe, err := getUniverse(ctx) + universe, err := srv.getUniverse(ctx) if err != nil { return nil, fmt.Errorf("killing simple failed with: %s", err.Error()) } diff --git a/service/api/inject_universe.go b/service/api/inject_universe.go index 1990232..7637c6d 100644 --- a/service/api/inject_universe.go +++ b/service/api/inject_universe.go @@ -7,25 +7,25 @@ import ( "github.com/taubyte/tau/libdream/common" ) -func injectUniverseHttp() { +func (srv *multiverseService) injectUniverseHttp() { // Path to create simples in a universe - serviceApi.POST(&httpIface.RouteDefinition{ + srv.rest.POST(&httpIface.RouteDefinition{ Path: "/universe/{universe}", Vars: httpIface.Variables{ Required: []string{"universe", "config"}, }, - Handler: apiHandlerUniverse, + Handler: srv.apiHandlerUniverse, }) } -func apiHandlerUniverse(ctx httpIface.Context) (interface{}, error) { +func (srv *multiverseService) apiHandlerUniverse(ctx httpIface.Context) (interface{}, error) { name, err := ctx.GetStringVariable("universe") if err != nil { return nil, fmt.Errorf("failed getting name with: %w", err) } // Grab the universe - exist := mv.Exist(name) + exist := srv.Exist(name) if exist { return nil, fmt.Errorf("universe `%s` already exists", name) } @@ -39,6 +39,6 @@ func apiHandlerUniverse(ctx httpIface.Context) (interface{}, error) { return nil, err } - u := mv.Universe(name) + u := srv.Universe(name) return nil, u.StartWithConfig(config.Config) } diff --git a/service/api/kill_node_by_id.go b/service/api/kill_node_by_id.go index 8335790..c01d5f4 100644 --- a/service/api/kill_node_by_id.go +++ b/service/api/kill_node_by_id.go @@ -6,20 +6,20 @@ import ( httpIface "github.com/taubyte/http" ) -func killNodeIdHttp() { +func (srv *multiverseService) killNodeIdHttp() { // Path to delete services/simple in a universe - serviceApi.DELETE(&httpIface.RouteDefinition{ + srv.rest.DELETE(&httpIface.RouteDefinition{ Path: "/node/{universe}/{name}/{id}", Vars: httpIface.Variables{ Required: []string{"universe", "name", "id"}, }, - Handler: killNodeById, + Handler: srv.killNodeById, }) } -func killNodeById(ctx httpIface.Context) (interface{}, error) { +func (srv *multiverseService) killNodeById(ctx httpIface.Context) (interface{}, error) { // Grab the universe - universe, err := getUniverse(ctx) + universe, err := srv.getUniverse(ctx) if err != nil { return nil, fmt.Errorf("killing service failed with: %s", err.Error()) } diff --git a/service/api/kill_service.go b/service/api/kill_service.go index 904f350..3a591f6 100644 --- a/service/api/kill_service.go +++ b/service/api/kill_service.go @@ -6,22 +6,20 @@ import ( httpIface "github.com/taubyte/http" ) -func killServiceHttp() { +func (srv *multiverseService) killServiceHttp() { // Path to delete services/simple in a universe - serviceApi.DELETE(&httpIface.RouteDefinition{ + srv.rest.DELETE(&httpIface.RouteDefinition{ Path: "/service/{universe}/{name}", Vars: httpIface.Variables{ Required: []string{"universe", "name"}, }, - Handler: killService, + Handler: srv.killService, }) } -func killService(ctx httpIface.Context) (interface{}, error) { - // FIXME: not stopping http server - +func (srv *multiverseService) killService(ctx httpIface.Context) (interface{}, error) { // Grab the universe - universe, err := getUniverse(ctx) + universe, err := srv.getUniverse(ctx) if err != nil { return nil, fmt.Errorf("killing service failed with: %s", err.Error()) } diff --git a/service/api/kill_simple.go b/service/api/kill_simple.go index 586b90b..e16681c 100644 --- a/service/api/kill_simple.go +++ b/service/api/kill_simple.go @@ -6,20 +6,20 @@ import ( httpIface "github.com/taubyte/http" ) -func killSimpleHttp() { +func (srv *multiverseService) killSimpleHttp() { // Path to delete simples in a universe - serviceApi.DELETE(&httpIface.RouteDefinition{ + srv.rest.DELETE(&httpIface.RouteDefinition{ Path: "/simple/{universe}/{name}", Vars: httpIface.Variables{ Required: []string{"universe", "name"}, }, - Handler: killSimple, + Handler: srv.killSimple, }) } -func killSimple(ctx httpIface.Context) (interface{}, error) { +func (srv *multiverseService) killSimple(ctx httpIface.Context) (interface{}, error) { // Grab the universe - universe, err := getUniverse(ctx) + universe, err := srv.getUniverse(ctx) if err != nil { return nil, fmt.Errorf("killing simple failed with: %s", err.Error()) } diff --git a/service/api/kill_universe.go b/service/api/kill_universe.go index 51bca65..1b4afa7 100644 --- a/service/api/kill_universe.go +++ b/service/api/kill_universe.go @@ -6,29 +6,29 @@ import ( httpIface "github.com/taubyte/http" ) -func killUniverseHttp() { +func (srv *multiverseService) killUniverseHttp() { // Path to delete simples in a universe - serviceApi.DELETE(&httpIface.RouteDefinition{ + srv.rest.DELETE(&httpIface.RouteDefinition{ Path: "/universe/{universe}", Vars: httpIface.Variables{ Required: []string{"universe"}, }, - Handler: killUniverse, + Handler: srv.killUniverse, }) } -func killUniverse(ctx httpIface.Context) (interface{}, error) { +func (srv *multiverseService) killUniverse(ctx httpIface.Context) (interface{}, error) { // Grab the universe name, err := ctx.GetStringVariable("universe") if err != nil { return nil, fmt.Errorf("failed getting name error %w", err) } - if !mv.Exist(name) { + if !srv.Exist(name) { return nil, fmt.Errorf("universe `%s` does not exist", name) } - universe, err := getUniverse(ctx) + universe, err := srv.getUniverse(ctx) if err != nil { return nil, fmt.Errorf("killing universe `%s` failed with: %s", name, err.Error()) } diff --git a/service/api/les_miserables_http.go b/service/api/les_miserables_http.go index baabcdc..787aa65 100644 --- a/service/api/les_miserables_http.go +++ b/service/api/les_miserables_http.go @@ -6,13 +6,13 @@ import ( httpIface "github.com/taubyte/http" ) -func lesMiesrablesHttp() { - serviceApi.GET(&httpIface.RouteDefinition{ +func (srv *multiverseService) lesMiesrablesHttp() { + srv.rest.GET(&httpIface.RouteDefinition{ Path: "/les/miserables/{universe}", Vars: httpIface.Variables{ Required: []string{"universe"}, }, - Handler: apiHandlerLesMiesrable, + Handler: srv.apiHandlerLesMiesrable, }) } @@ -38,17 +38,17 @@ type Echart struct { Categories []*EchartCat `json:"categories"` } -func apiHandlerLesMiesrable(ctx httpIface.Context) (interface{}, error) { +func (srv *multiverseService) apiHandlerLesMiesrable(ctx httpIface.Context) (interface{}, error) { universeName, err := ctx.GetStringVariable("universe") if err != nil { return nil, err } - exists := mv.Exist(universeName) + exists := srv.Exist(universeName) if !exists { return nil, fmt.Errorf("universe `%s` does not exit", universeName) } - u := mv.Universe(universeName) + u := srv.Universe(universeName) ret := &Echart{ Nodes: make([]*EchartNode, 0), diff --git a/service/api/ping.go b/service/api/ping.go new file mode 100644 index 0000000..19290fd --- /dev/null +++ b/service/api/ping.go @@ -0,0 +1,14 @@ +package api + +import ( + httpIface "github.com/taubyte/http" +) + +func (srv *multiverseService) pingHttp() { + srv.rest.GET(&httpIface.RouteDefinition{ + Path: "/ping", + Handler: func(httpIface.Context) (interface{}, error) { + return "pong", nil + }, + }) +} diff --git a/service/api/status_http.go b/service/api/status_http.go index 3874dc6..2ebd74a 100644 --- a/service/api/status_http.go +++ b/service/api/status_http.go @@ -4,13 +4,11 @@ import ( httpIface "github.com/taubyte/http" ) -func statusHttp() { - serviceApi.GET(&httpIface.RouteDefinition{ - Path: "/status", - Handler: statusHandler, +func (srv *multiverseService) statusHttp() { + srv.rest.GET(&httpIface.RouteDefinition{ + Path: "/status", + Handler: func(ctx httpIface.Context) (interface{}, error) { + return srv.Status(), nil + }, }) } - -func statusHandler(ctx httpIface.Context) (interface{}, error) { - return mv.Status(), nil -} diff --git a/service/api/valid_clients.go b/service/api/valid_clients.go index 13073af..3e0da70 100644 --- a/service/api/valid_clients.go +++ b/service/api/valid_clients.go @@ -4,13 +4,11 @@ import ( httpIface "github.com/taubyte/http" ) -func validClients() { - serviceApi.GET(&httpIface.RouteDefinition{ - Path: "/spec/clients", - Handler: clientsHandler, +func (srv *multiverseService) validClients() { + srv.rest.GET(&httpIface.RouteDefinition{ + Path: "/spec/clients", + Handler: func(ctx httpIface.Context) (interface{}, error) { + return srv.ValidClients(), nil + }, }) } - -func clientsHandler(ctx httpIface.Context) (interface{}, error) { - return mv.ValidClients(), nil -} diff --git a/service/api/valid_fixtures.go b/service/api/valid_fixtures.go index b617cdd..3e86200 100644 --- a/service/api/valid_fixtures.go +++ b/service/api/valid_fixtures.go @@ -4,13 +4,11 @@ import ( httpIface "github.com/taubyte/http" ) -func validFixtures() { - serviceApi.GET(&httpIface.RouteDefinition{ - Path: "/spec/fixtures", - Handler: fixturesHandler, +func (srv *multiverseService) validFixtures() { + srv.rest.GET(&httpIface.RouteDefinition{ + Path: "/spec/fixtures", + Handler: func(ctx httpIface.Context) (interface{}, error) { + return srv.ValidFixtures(), nil + }, }) } - -func fixturesHandler(ctx httpIface.Context) (interface{}, error) { - return mv.ValidFixtures(), nil -} diff --git a/service/api/valid_services.go b/service/api/valid_services.go index 7969132..8614151 100644 --- a/service/api/valid_services.go +++ b/service/api/valid_services.go @@ -4,13 +4,11 @@ import ( httpIface "github.com/taubyte/http" ) -func validServices() { - serviceApi.GET(&httpIface.RouteDefinition{ - Path: "/spec/services", - Handler: servicesHandler, +func (srv *multiverseService) validServices() { + srv.rest.GET(&httpIface.RouteDefinition{ + Path: "/spec/services", + Handler: func(ctx httpIface.Context) (interface{}, error) { + return srv.ValidServices(), nil + }, }) } - -func servicesHandler(ctx httpIface.Context) (interface{}, error) { - return mv.ValidServices(), nil -} From b06d60c086f1034533815030eb6d9f7e15568113 Mon Sep 17 00:00:00 2001 From: arontaubyte <95320652+arontaubyte@users.noreply.github.com> Date: Fri, 28 Jul 2023 13:57:33 -0500 Subject: [PATCH 2/4] 14 remove duplicate call (#14) * removed duplicate call * removed duplicate call * changed tau to point to commit --- cli/new/helpers.go | 17 ++++++----------- cli/tests/universe_test.go | 8 ++++---- fixtures/attach_prod_project_test.go | 2 +- fixtures/clear_repos_test.go | 2 +- fixtures/config_compiler_test.go | 2 +- fixtures/decompile_prod_test.go | 2 +- fixtures/fake_project_test.go | 2 +- fixtures/http_test.go | 2 +- fixtures/import_prod_project_test.go | 2 +- fixtures/indexer_test.go | 2 +- fixtures/publish_test.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- service/universe_test.go | 2 +- 14 files changed, 23 insertions(+), 28 deletions(-) diff --git a/cli/new/helpers.go b/cli/new/helpers.go index c575eab..ecdf8e1 100644 --- a/cli/new/helpers.go +++ b/cli/new/helpers.go @@ -200,18 +200,13 @@ func startUniverses(c *cli.Context) (err error) { return err } - uid := c.String("id") for _, universe := range c.StringSlice("universes") { var u commonDreamland.Universe - if uid == "" { - u = services.Multiverse(universe) - } else { - u = services.MultiverseWithConfig(services.UniverseConfig{ - Name: universe, - KeepRoot: c.Bool("keep"), - Id: uid, - }) - } + u = services.Multiverse(services.UniverseConfig{ + Name: universe, + Id: c.String("id"), + KeepRoot: c.Bool("keep"), + }) err = u.StartWithConfig(config) if err != nil { return err @@ -223,7 +218,7 @@ func startUniverses(c *cli.Context) (err error) { func startEmptyUniverses(c *cli.Context) (err error) { for _, universe := range c.StringSlice("universes") { - u := services.Multiverse(universe) + u := services.Multiverse(services.UniverseConfig{Name: universe}) err = u.StartWithConfig(&commonDreamland.Config{}) if err != nil { return err diff --git a/cli/tests/universe_test.go b/cli/tests/universe_test.go index 22ec96e..6000469 100644 --- a/cli/tests/universe_test.go +++ b/cli/tests/universe_test.go @@ -21,7 +21,7 @@ var services = []string{"seer", "auth", "patrick", "tns", "monkey", "hoarder", " func TestKillService(t *testing.T) { t.Skip("this test needs to be redone") api.BigBang() - u := dreamland.Multiverse("KillService") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "KillService"}) err := u.StartWithConfig(&common.Config{ Services: map[string]commonIface.ServiceConfig{}, Clients: map[string]commonIface.ClientConfig{}, @@ -88,7 +88,7 @@ func TestKillSimple(t *testing.T) { statusName := fmt.Sprintf("%s@%s", testSimpleName, universeName) api.BigBang() - u := dreamland.Multiverse(universeName) + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: universeName}) err := u.StartWithConfig(&common.Config{ Clients: map[string]commonIface.ClientConfig{}, Simples: map[string]common.SimpleConfig{ @@ -185,7 +185,7 @@ func TestKillSimple(t *testing.T) { } func TestUniverseAll(t *testing.T) { - u := dreamland.Multiverse("single") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "single"}) defer u.Stop() err := u.StartAll() if err != nil { @@ -233,7 +233,7 @@ func TestUniverseAll(t *testing.T) { } func TestMultipleServices(t *testing.T) { - u := dreamland.Multiverse("multiple") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "multiple"}) defer u.Stop() err := u.StartWithConfig(&common.Config{ Services: map[string]commonIface.ServiceConfig{ diff --git a/fixtures/attach_prod_project_test.go b/fixtures/attach_prod_project_test.go index 4aebfe1..54d1536 100644 --- a/fixtures/attach_prod_project_test.go +++ b/fixtures/attach_prod_project_test.go @@ -15,7 +15,7 @@ import ( ) func TestAttachProdProject(t *testing.T) { - u := dreamland.Multiverse("testrunlibrary") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "testrunlibrary"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ diff --git a/fixtures/clear_repos_test.go b/fixtures/clear_repos_test.go index 9817644..20c140b 100644 --- a/fixtures/clear_repos_test.go +++ b/fixtures/clear_repos_test.go @@ -9,7 +9,7 @@ import ( ) func TestClearRepos(t *testing.T) { - u := dreamland.Multiverse("TestImportProdProject") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "TestImportProdProject"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ diff --git a/fixtures/config_compiler_test.go b/fixtures/config_compiler_test.go index d800d62..9a38c61 100644 --- a/fixtures/config_compiler_test.go +++ b/fixtures/config_compiler_test.go @@ -28,7 +28,7 @@ import ( func TestE2E(t *testing.T) { // TNS magic - u := dreamland.Multiverse("scratch") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "scratch"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ Services: map[string]commonIface.ServiceConfig{ diff --git a/fixtures/decompile_prod_test.go b/fixtures/decompile_prod_test.go index fe29cde..f1b5884 100644 --- a/fixtures/decompile_prod_test.go +++ b/fixtures/decompile_prod_test.go @@ -21,7 +21,7 @@ import ( func TestDecompileProd(t *testing.T) { t.Skip("using an old project") - u := dreamland.Multiverse("scratch") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "scratch"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ Services: map[string]commonIface.ServiceConfig{ diff --git a/fixtures/fake_project_test.go b/fixtures/fake_project_test.go index fca5b9c..8ce4215 100644 --- a/fixtures/fake_project_test.go +++ b/fixtures/fake_project_test.go @@ -12,7 +12,7 @@ import ( func TestFakeProject(t *testing.T) { t.Skip("needs to be reimplemented") - u := dreamland.Multiverse("TestFakeProject") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "TestFakeProject"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ Services: map[string]commonIface.ServiceConfig{ diff --git a/fixtures/http_test.go b/fixtures/http_test.go index 60b5dd4..8db6aad 100644 --- a/fixtures/http_test.go +++ b/fixtures/http_test.go @@ -18,7 +18,7 @@ import ( func TestHttp(t *testing.T) { t.Skip("using an old project") - u := dreamland.Multiverse("scratch") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "scratch"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ Services: map[string]commonIface.ServiceConfig{ diff --git a/fixtures/import_prod_project_test.go b/fixtures/import_prod_project_test.go index 8aeee15..3124e40 100644 --- a/fixtures/import_prod_project_test.go +++ b/fixtures/import_prod_project_test.go @@ -19,7 +19,7 @@ func TestImportProdProject(t *testing.T) { spec.DefaultBranch = "master_test" - u := dreamland.Multiverse("TestImportProdProject") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "TestImportProdProject"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ diff --git a/fixtures/indexer_test.go b/fixtures/indexer_test.go index 23383bb..d25feb0 100644 --- a/fixtures/indexer_test.go +++ b/fixtures/indexer_test.go @@ -15,7 +15,7 @@ import ( func TestIndexer(t *testing.T) { t.Skip("needs to be reimplemented") - u := dreamland.Multiverse("indexer") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "indexer"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ Services: map[string]commonIface.ServiceConfig{ diff --git a/fixtures/publish_test.go b/fixtures/publish_test.go index 2642630..fd9357a 100644 --- a/fixtures/publish_test.go +++ b/fixtures/publish_test.go @@ -16,7 +16,7 @@ import ( func TestUpdate(t *testing.T) { t.Skip("needs to be reimplemented") - u := services.Multiverse("single_e2e") + u := services.Multiverse(services.UniverseConfig{Name: "single_e2e"}) defer u.Stop() err := u.StartWithConfig(&commonDreamland.Config{ diff --git a/go.mod b/go.mod index 3bb5120..d577e51 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/taubyte/go-project-schema v0.9.3 github.com/taubyte/go-specs v0.10.5 github.com/taubyte/http v0.10.3 - github.com/taubyte/tau v0.1.0 + github.com/taubyte/tau v0.0.0-20230728185337-876124b14a81 github.com/taubyte/utils v0.1.6 github.com/urfave/cli/v2 v2.25.7 golang.org/x/oauth2 v0.10.0 diff --git a/go.sum b/go.sum index 131d171..37bc261 100644 --- a/go.sum +++ b/go.sum @@ -902,8 +902,8 @@ github.com/taubyte/http v0.10.3/go.mod h1:iYTdJl6dk3m1tC6H5WAJRX/R81ROwy7cg++zaz github.com/taubyte/odo v0.0.0-20230727154809-0688a5d7674b h1:2Jt0GOC/2OoSG8R+SG8ctWD1m8XVla3IMb4Z69QIZLg= github.com/taubyte/p2p v0.9.1 h1:W8whhWbYO5oCqOSUM+gNKCERtVGmTJHTZuTw+MJuswg= github.com/taubyte/p2p v0.9.1/go.mod h1:0vWZjiX8yNT3VwZO2x+mgRdEDCbwzSPOyyfBU3UEiTk= -github.com/taubyte/tau v0.1.0 h1:wpyNNZa6lHYiTyd2u+jh6574NUhkgzP5BZuUAOC0Rt4= -github.com/taubyte/tau v0.1.0/go.mod h1:Oz3n9Zn5HaHUFRXjxP0dhdjeeL11HCHTJbjHybx0h6M= +github.com/taubyte/tau v0.0.0-20230728185337-876124b14a81 h1:QAGlsOqq6VRWHZjQH1P0q5NRQfpeSeaH5p/BJ26p+Sc= +github.com/taubyte/tau v0.0.0-20230728185337-876124b14a81/go.mod h1:Oz3n9Zn5HaHUFRXjxP0dhdjeeL11HCHTJbjHybx0h6M= github.com/taubyte/tau-cli v0.1.8 h1:81VcK9ZfKoAwzjwhnxQkxXa/kjv9fyb4kUephaqcxa0= github.com/taubyte/tau-cli v0.1.8/go.mod h1:4BC0INT2qB3RnDVooAPuc8XWu7trU4smhJ/XdhKjYkA= github.com/taubyte/utils v0.1.6 h1:bRSJZW/8E/wpT3wwyU3C97M9ddAJ52AfXFeP47JRGsY= diff --git a/service/universe_test.go b/service/universe_test.go index 9749186..2df3b9b 100644 --- a/service/universe_test.go +++ b/service/universe_test.go @@ -32,7 +32,7 @@ func TestRoutes(t *testing.T) { return } - u := dreamland.Multiverse("dreamland-http") + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "dreamland-http"}) defer u.Stop() err = u.StartWithConfig(&commonDreamland.Config{ From d25ad7a3f221a16248236bf2c9cf986788052b36 Mon Sep 17 00:00:00 2001 From: Tafseer Khan Date: Fri, 28 Jul 2023 18:15:58 -0500 Subject: [PATCH 3/4] fixes --- cli/tests/universe_test.go | 8 +- fixtures/attach_prod_project.go | 130 -------------- fixtures/attach_prod_project_test.go | 50 ------ fixtures/clear_repos.go | 116 ------------- fixtures/clear_repos_test.go | 33 ---- fixtures/compile.go | 38 ---- fixtures/config_compiler_test.go | 251 --------------------------- fixtures/decompile_prod_test.go | 123 ------------- fixtures/dreamland.go | 10 -- fixtures/fake_project.go | 27 --- fixtures/fake_project_test.go | 39 ----- fixtures/helpers_test.go | 14 -- fixtures/http_test.go | 144 --------------- fixtures/import_prod_project.go | 221 ----------------------- fixtures/import_prod_project_test.go | 53 ------ fixtures/indexer_test.go | 96 ---------- fixtures/inject_project.go | 27 --- fixtures/publish_test.go | 98 ----------- go.mod | 14 +- go.sum | 6 +- main.go | 2 +- service/universe_test.go | 2 +- 22 files changed, 16 insertions(+), 1486 deletions(-) delete mode 100644 fixtures/attach_prod_project.go delete mode 100644 fixtures/attach_prod_project_test.go delete mode 100644 fixtures/clear_repos.go delete mode 100644 fixtures/clear_repos_test.go delete mode 100644 fixtures/compile.go delete mode 100644 fixtures/config_compiler_test.go delete mode 100644 fixtures/decompile_prod_test.go delete mode 100644 fixtures/dreamland.go delete mode 100644 fixtures/fake_project.go delete mode 100644 fixtures/fake_project_test.go delete mode 100644 fixtures/helpers_test.go delete mode 100644 fixtures/http_test.go delete mode 100644 fixtures/import_prod_project.go delete mode 100644 fixtures/import_prod_project_test.go delete mode 100644 fixtures/indexer_test.go delete mode 100644 fixtures/inject_project.go delete mode 100644 fixtures/publish_test.go diff --git a/cli/tests/universe_test.go b/cli/tests/universe_test.go index 6000469..2e59fa9 100644 --- a/cli/tests/universe_test.go +++ b/cli/tests/universe_test.go @@ -21,7 +21,7 @@ var services = []string{"seer", "auth", "patrick", "tns", "monkey", "hoarder", " func TestKillService(t *testing.T) { t.Skip("this test needs to be redone") api.BigBang() - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "KillService"}) + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: t.Name()}) err := u.StartWithConfig(&common.Config{ Services: map[string]commonIface.ServiceConfig{}, Clients: map[string]commonIface.ClientConfig{}, @@ -88,7 +88,7 @@ func TestKillSimple(t *testing.T) { statusName := fmt.Sprintf("%s@%s", testSimpleName, universeName) api.BigBang() - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: universeName}) + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: t.Name()}) err := u.StartWithConfig(&common.Config{ Clients: map[string]commonIface.ClientConfig{}, Simples: map[string]common.SimpleConfig{ @@ -185,7 +185,7 @@ func TestKillSimple(t *testing.T) { } func TestUniverseAll(t *testing.T) { - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "single"}) + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: t.Name()}) defer u.Stop() err := u.StartAll() if err != nil { @@ -233,7 +233,7 @@ func TestUniverseAll(t *testing.T) { } func TestMultipleServices(t *testing.T) { - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "multiple"}) + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: t.Name()}) defer u.Stop() err := u.StartWithConfig(&common.Config{ Services: map[string]commonIface.ServiceConfig{ diff --git a/fixtures/attach_prod_project.go b/fixtures/attach_prod_project.go deleted file mode 100644 index 4afe103..0000000 --- a/fixtures/attach_prod_project.go +++ /dev/null @@ -1,130 +0,0 @@ -package fixtures - -import ( - "context" - "errors" - "fmt" - "io" - "strings" - - "github.com/google/go-github/github" - httpAuthClient "github.com/taubyte/tau/clients/http/auth" - commonDreamland "github.com/taubyte/tau/libdream/common" - "github.com/taubyte/tau/libdream/helpers" - dreamlandRegistry "github.com/taubyte/tau/libdream/registry" - commonAuth "github.com/taubyte/tau/protocols/common" - "golang.org/x/oauth2" -) - -func init() { - dreamlandRegistry.Fixture("attachProdProject", attachProdProject) -} - -// Added this variable so that import can call the attachProdProjectFixture, without having -// to rewrite code -var SharedRepositoryData *httpAuthClient.RawRepoDataOuter - -func attachProdProject(u commonDreamland.Universe, params ...interface{}) error { - if len(params) < 2 { - return errors.New("attachProdProject expects 2 parameters [project-id] [git-token]") - } - - projectId := params[0].(string) - if len(projectId) > 0 { - helpers.ProjectID = projectId - } - - gitToken := params[1].(string) - if len(gitToken) > 0 { - helpers.GitToken = gitToken - } - - prodAuthURL := "https://auth.taubyte.com" - prodClient, err := httpAuthClient.New(u.Context(), httpAuthClient.URL(prodAuthURL), httpAuthClient.Auth(gitToken), httpAuthClient.Unsecure(), httpAuthClient.Provider(helpers.GitProvider)) - if err != nil { - return fmt.Errorf("creating new auth client failed with: %w", err) - } - - project, err := prodClient.GetProjectById(projectId) - if err != nil { - return fmt.Errorf("getting project `%s` failed with: %w", projectId, err) - } - - SharedRepositoryData, err = project.Repositories() - if err != nil { - return fmt.Errorf("getting repository data failed with: %w", err) - } - - // Override auth method so that projectID is not changed - commonAuth.GetNewProjectID = func(args ...interface{}) string { - return projectId - } - - SharedRepositoryData.Configuration.Id, err = GetRepoId(u.Context(), SharedRepositoryData.Configuration.Fullname, gitToken) - if err != nil { - return fmt.Errorf("getting config repo Id failed with: %w", err) - } - - SharedRepositoryData.Code.Id, err = GetRepoId(u.Context(), SharedRepositoryData.Code.Fullname, gitToken) - if err != nil { - return fmt.Errorf("getting code repo Id failed with: %w", err) - } - - devAuthUrl, err := u.GetURLHttp(u.Auth().Node()) - if err != nil { - return fmt.Errorf("getting auth url failed with: %w", err) - } - - devClient, err := httpAuthClient.New(u.Context(), httpAuthClient.URL(devAuthUrl), httpAuthClient.Auth(gitToken), httpAuthClient.Provider(helpers.GitProvider)) - if err != nil { - return fmt.Errorf("creating new http auth client failed with %w", err) - } - - if err = devClient.RegisterRepository(SharedRepositoryData.Configuration.Id); err != nil { - return fmt.Errorf("registering config repo failed with: %w", err) - } - - if err = devClient.RegisterRepository(SharedRepositoryData.Code.Id); err != nil { - return fmt.Errorf("registering code repo failed with: %w", err) - } - - if err = project.Create(devClient, SharedRepositoryData.Configuration.Id, SharedRepositoryData.Code.Id); err != nil { - return fmt.Errorf("creating project failed with: %w", err) - } - - return nil -} - -func GetRepoId(ctx context.Context, repoFullName string, token string) (string, error) { - gitClient := newGithubClient(ctx, token) - if len(repoFullName) == 0 { - return "", errors.New("repo not found") - } - - repoFullnameSplit := strings.Split(repoFullName, "/") - repo, resp, err := gitClient.Repositories.Get(ctx, repoFullnameSplit[0], repoFullnameSplit[1]) - if err != nil { - body, err0 := io.ReadAll(resp.Body) - defer resp.Body.Close() - if err0 != nil { - return "", fmt.Errorf("calling github api failed with: [%v & %v]", err, err0) - } - return "", fmt.Errorf("getting github repo failed with %v, got response %s", err, string(body)) - } - - return fmt.Sprintf("%d", repo.GetID()), nil -} - -var gitClient *github.Client - -func newGithubClient(ctx context.Context, token string) *github.Client { - if gitClient != nil { - return gitClient - } - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: token}, - ) - tc := oauth2.NewClient(ctx, ts) - gitClient = github.NewClient(tc) - return gitClient -} diff --git a/fixtures/attach_prod_project_test.go b/fixtures/attach_prod_project_test.go deleted file mode 100644 index 54d1536..0000000 --- a/fixtures/attach_prod_project_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package fixtures - -import ( - "testing" - - commonIface "github.com/taubyte/go-interfaces/common" - commonDreamland "github.com/taubyte/tau/libdream/common" - "github.com/taubyte/tau/libdream/helpers" - dreamland "github.com/taubyte/tau/libdream/services" - _ "github.com/taubyte/tau/protocols/auth" - _ "github.com/taubyte/tau/protocols/hoarder" - _ "github.com/taubyte/tau/protocols/monkey" - _ "github.com/taubyte/tau/protocols/patrick" - _ "github.com/taubyte/tau/protocols/tns" -) - -func TestAttachProdProject(t *testing.T) { - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "testrunlibrary"}) - defer u.Stop() - - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{ - "auth": {}, - "tns": {}, - "monkey": {}, - "patrick": {}, - "hoarder": {}, - }, - Simples: map[string]commonDreamland.SimpleConfig{ - "client": { - Clients: commonDreamland.SimpleConfigClients{ - TNS: &commonIface.ClientConfig{}, - Auth: &commonIface.ClientConfig{}, - Patrick: &commonIface.ClientConfig{}, - }, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - err = u.RunFixture("attachProdProject", helpers.ProjectID, helpers.GitToken, "dreamland") - if err != nil { - t.Error(err) - return - } - -} diff --git a/fixtures/clear_repos.go b/fixtures/clear_repos.go deleted file mode 100644 index d7de3e1..0000000 --- a/fixtures/clear_repos.go +++ /dev/null @@ -1,116 +0,0 @@ -package fixtures - -import ( - "context" - "errors" - "fmt" - "io" - "strings" - - "github.com/google/go-github/github" - "github.com/taubyte/tau/libdream/common" - commonTest "github.com/taubyte/tau/libdream/helpers" - dreamlandRegistry "github.com/taubyte/tau/libdream/registry" - "golang.org/x/oauth2" -) - -func init() { - dreamlandRegistry.Fixture("clearRepos", clearRepos) -} - -func clearRepos(u common.Universe, params ...interface{}) error { - if len(params) > 0 { - return errors.New("parameters are unused") - } - client := githubApiClient(u, commonTest.GitToken) - repos, _, err := client.Repositories.List(u.Context(), "", &github.RepositoryListOptions{ - ListOptions: github.ListOptions{PerPage: 1000}, - }) - if err != nil { - return fmt.Errorf("listing repositories failed with") - } - - res, err := client.Repositories.DownloadContents(context.Background(), commonTest.GitUser, "tb_testProject", "keep_repos.txt", nil) - if err != nil { - fmt.Println("failed with:", err) - } - defer res.Close() - - body, err := io.ReadAll(res) - if err != nil { - return err - } - - keepRepos := strings.Split(string(body), "\n") - if len(keepRepos) < 4 { - return fmt.Errorf("not enough repos") - } - - for _, repo := range repos { - name := *repo.Name - - var found bool - for _, _name := range keepRepos { - if _name == name { - found = true - break - } - } - - if found { - fmt.Printf("Listing keys -- %s/%s\n", commonTest.GitUser, name) - keys, gitResponse, err := client.Repositories.ListKeys(u.Context(), commonTest.GitUser, name, &github.ListOptions{PerPage: 1000}) - if err != nil { - return fmt.Errorf("listing keys for %s failed with: %w", name, err) - } - fmt.Printf("Listing keys RESP %#v\n", gitResponse) - - for { - for _, key := range keys { - if strings.Contains(*key.Title, "_dev") || *key.Title == "go-simple-git-clone-with-deploy-key" { - gitResponse, err = client.Repositories.DeleteKey(u.Context(), commonTest.GitUser, name, key.GetID()) - fmt.Println("Deleting", *key.Title, ":", gitResponse) - if err != nil { - return fmt.Errorf("deleting key for %s: `%s`, failed with: %w", name, *key.Title, err) - } - } - } - - fmt.Printf("Listing keys again -- %s/%s\n", commonTest.GitUser, name) - keys, gitResponse, err = client.Repositories.ListKeys(u.Context(), commonTest.GitUser, name, &github.ListOptions{PerPage: 1000}) - if err != nil { - return fmt.Errorf("listing keys for %s failed with: %w", name, err) - } - fmt.Printf("Listing keys again RESP %#v\n", gitResponse) - - deletableKeys := []string{} - for _, key := range keys { - if strings.Contains(*key.Title, "_dev") || *key.Title == "go-simple-git-clone-with-deploy-key" { - deletableKeys = append(deletableKeys, *key.Title) - } - } - - if len(deletableKeys) == 0 { - break - } - } - } else { - fmt.Printf("DELETING %s/%s \n", commonTest.GitUser, name) - _, err = client.Repositories.Delete(u.Context(), commonTest.GitUser, name) - if err != nil { - return fmt.Errorf("deleting %s failed with: %w", name, err) - } - } - } - - return nil -} - -func githubApiClient(u common.Universe, token string) *github.Client { - ts := oauth2.StaticTokenSource( - &oauth2.Token{AccessToken: token}, - ) - tc := oauth2.NewClient(u.Context(), ts) - - return github.NewClient(tc) -} diff --git a/fixtures/clear_repos_test.go b/fixtures/clear_repos_test.go deleted file mode 100644 index 20c140b..0000000 --- a/fixtures/clear_repos_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package fixtures - -import ( - "testing" - - commonIface "github.com/taubyte/go-interfaces/common" - commonDreamland "github.com/taubyte/tau/libdream/common" - dreamland "github.com/taubyte/tau/libdream/services" -) - -func TestClearRepos(t *testing.T) { - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "TestImportProdProject"}) - defer u.Stop() - - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{}, - Simples: map[string]commonDreamland.SimpleConfig{ - "client": { - Clients: commonDreamland.SimpleConfigClients{}, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - err = u.RunFixture("clearRepos") - if err != nil { - t.Error(err) - return - } -} diff --git a/fixtures/compile.go b/fixtures/compile.go deleted file mode 100644 index 727aeea..0000000 --- a/fixtures/compile.go +++ /dev/null @@ -1,38 +0,0 @@ -package fixtures - -import ( - "github.com/taubyte/config-compiler/compile" - "github.com/taubyte/go-project-schema/project" - "github.com/taubyte/tau/libdream/common" - commonTest "github.com/taubyte/tau/libdream/helpers" -) - -func inject(project project.Project, simple common.Simple) error { - fakeMeta := commonTest.ConfigRepo.HookInfo - fakeMeta.Repository.Provider = "github" - fakeMeta.Repository.Branch = "master" - fakeMeta.HeadCommit.ID = "testCommit" - rc, err := compile.CompilerConfig(project, fakeMeta) - if err != nil { - return err - } - - compiler, err := compile.New(rc, compile.Dev()) - if err != nil { - return err - } - defer compiler.Close() - - err = compiler.Build() - if err != nil { - return err - } - - // publish ( compile & send to TNS ) - err = compiler.Publish(simple.TNS()) - if err != nil { - return err - } - - return nil -} diff --git a/fixtures/config_compiler_test.go b/fixtures/config_compiler_test.go deleted file mode 100644 index 9a38c61..0000000 --- a/fixtures/config_compiler_test.go +++ /dev/null @@ -1,251 +0,0 @@ -package fixtures - -import ( - "encoding/json" - "fmt" - "os" - "reflect" - "testing" - - "github.com/taubyte/config-compiler/compile" - "github.com/taubyte/config-compiler/decompile" - commonTest "github.com/taubyte/tau/libdream/helpers" - gitTest "github.com/taubyte/tau/libdream/helpers/git" - - commonIface "github.com/taubyte/go-interfaces/common" - commonDreamland "github.com/taubyte/tau/libdream/common" - dreamland "github.com/taubyte/tau/libdream/services" - - "github.com/spf13/afero" - tnsIface "github.com/taubyte/go-interfaces/services/tns" - projectLib "github.com/taubyte/go-project-schema/project" - functionSpec "github.com/taubyte/go-specs/function" - librarySpec "github.com/taubyte/go-specs/library" - specs "github.com/taubyte/go-specs/methods" - websiteSpec "github.com/taubyte/go-specs/website" - _ "github.com/taubyte/tau/clients/p2p/tns" -) - -func TestE2E(t *testing.T) { - // TNS magic - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "scratch"}) - defer u.Stop() - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{ - "tns": {}, - }, - Simples: map[string]commonDreamland.SimpleConfig{ - "me": { - Clients: commonDreamland.SimpleConfigClients{ - TNS: &commonIface.ClientConfig{}, - }, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - simple, err := u.Simple("me") - if err != nil { - t.Error(err) - return - } - tns := simple.TNS() - - gitRoot := "./testGIT" - gitRootConfig := gitRoot + "/config" - os.MkdirAll(gitRootConfig, 0755) - fakeMeta.Repository.Provider = "github" - - err = gitTest.CloneToDirSSH(u.Context(), gitRootConfig, commonTest.ConfigRepo) - if err != nil { - t.Error(err) - return - } - - // read with seer - projectIface, err := projectLib.Open(projectLib.SystemFS(gitRootConfig)) - if err != nil { - t.Error(err) - return - } - - rc, err := compile.CompilerConfig(projectIface, fakeMeta) - if err != nil { - t.Error(err) - return - } - - compiler, err := compile.New(rc, compile.Dev()) - if err != nil { - t.Error(err) - return - } - defer compiler.Close() - - err = compiler.Build() - if err != nil { - t.Error(err) - return - } - - // publish ( compile & send to TNS ) - err = compiler.Publish(tns) - if err != nil { - t.Error(err) - return - } - - _path, err := websiteSpec.Tns().HttpPath("testing_website_builder.com") - if err != nil { - t.Error(err) - return - } - - links := _path.Versioning().Links() - test_obj, err := tns.Fetch(links) - if test_obj == nil { - t.Error("NO OBject found", err) - return - } - - _, globalFunctions := projectIface.Get().Functions("") - for _, function := range globalFunctions { - wasmPath, err := functionSpec.Tns().WasmModulePath( - projectIface.Get().Id(), - "", - function, - ) - if err != nil { - t.Error(err) - return - } - - test_obj, err = tns.Fetch(wasmPath) - if err != nil || test_obj == nil { - t.Error("NO OBject found", err) - return - } - } - - _, globalLibraries := projectIface.Get().Libraries("") - for _, library := range globalLibraries { - wasmPath, err := librarySpec.Tns().WasmModulePath( - projectIface.Get().Id(), - "", - library, - ) - if err != nil { - t.Error(err) - return - } - - test_obj, err = tns.Fetch(wasmPath) - if err != nil || test_obj == nil { - t.Error("NO OBject found", err) - return - } - } - - // fetch - new_obj, err := tns.Fetch( - specs.ProjectPrefix( - projectIface.Get().Id(), - fakeMeta.Repository.Branch, - fakeMeta.HeadCommit.ID, - ), - ) - if err != nil { - t.Error(err) - return - } - if new_obj == nil { - t.Error("NO OBJECT FETCHED") - return - } - - // expect keys - _, err = tns.Lookup(tnsIface.Query{Prefix: []string{"repositories"}, RegEx: false}) - if err != nil { - t.Errorf("fetch keys failed with err: %s", err.Error()) - return - } - - // decompile - gitRootConfig_new := gitRootConfig + "_new" - os.MkdirAll(gitRootConfig_new, 0755) - decompiler, err := decompile.New(afero.NewBasePathFs(afero.NewOsFs(), gitRootConfig_new), new_obj.Interface()) - if err != nil { - t.Error(err) - return - } - - fetchedProjectIface, err := decompiler.Build() - if err != nil { - t.Error(err) - return - } - - rc, err = compile.CompilerConfig(projectIface, fakeMeta) - if err != nil { - t.Error(err) - return - } - - // check diff - // compare gitRootConfig and gitRootConfig_new - compiler, err = compile.New(rc, compile.Dev()) - if err != nil { - t.Error(err) - return - } - - err = compiler.Build() - if err != nil { - t.Error(err) - return - } - - _map := compiler.Object() - - rc, err = compile.CompilerConfig(fetchedProjectIface, fakeMeta) - if err != nil { - t.Error(err) - return - } - - compilerNew, err := compile.New(rc, compile.Dev()) - if err != nil { - t.Error(err) - return - } - - err = compilerNew.Build() - if err != nil { - t.Error(err) - return - } - - _map2 := compilerNew.Object() - if !reflect.DeepEqual(_map, _map2) { - - t.Error("Objects not equal") - - b1, err := json.Marshal(_map) - if err != nil { - t.Error(err) - return - } - b2, err := json.Marshal(_map2) - if err != nil { - t.Error(err) - return - } - - fmt.Println("\n\nB1:\n", string(b1)) - fmt.Println("\n\nB2:\n", string(b2)) - return - } -} diff --git a/fixtures/decompile_prod_test.go b/fixtures/decompile_prod_test.go deleted file mode 100644 index f1b5884..0000000 --- a/fixtures/decompile_prod_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package fixtures - -import ( - "os" - "testing" - - "github.com/spf13/afero" - "github.com/taubyte/config-compiler/compile" - "github.com/taubyte/config-compiler/decompile" - commonIface "github.com/taubyte/go-interfaces/common" - projectLib "github.com/taubyte/go-project-schema/project" - specs "github.com/taubyte/go-specs/methods" - _ "github.com/taubyte/tau/clients/p2p/tns" - commonDreamland "github.com/taubyte/tau/libdream/common" - commonTest "github.com/taubyte/tau/libdream/helpers" - gitTest "github.com/taubyte/tau/libdream/helpers/git" - dreamland "github.com/taubyte/tau/libdream/services" - _ "github.com/taubyte/tau/protocols/tns" - "github.com/taubyte/utils/maps" -) - -func TestDecompileProd(t *testing.T) { - t.Skip("using an old project") - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "scratch"}) - defer u.Stop() - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{ - "tns": {}, - }, - Simples: map[string]commonDreamland.SimpleConfig{ - "me": { - Clients: commonDreamland.SimpleConfigClients{ - TNS: &commonIface.ClientConfig{}, - }, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - simple, err := u.Simple("me") - if err != nil { - t.Error(err) - return - } - tns := simple.TNS() - - gitRoot := "./testGIT" - gitRootConfig := gitRoot + "/prodConfigDreamland" - os.MkdirAll(gitRootConfig, 0755) - - fakeMeta := commonTest.ConfigRepo.HookInfo - fakeMeta.Repository.SSHURL = "git@github.com:taubyte-test/tb_prodproject.git" - fakeMeta.Repository.Branch = "dreamland" - fakeMeta.Repository.Provider = "github" - - err = gitTest.CloneToDirSSH(u.Context(), gitRootConfig, commonTest.Repository{ - ID: 517160737, - Name: "tb_prodproject", - HookInfo: fakeMeta, - }) - if err != nil { - t.Error(err) - return - } - - // read with seer - projectIface, err := projectLib.Open(projectLib.SystemFS(gitRootConfig)) - if err != nil { - t.Error(err) - return - } - - rc, err := compile.CompilerConfig(projectIface, fakeMeta) - if err != nil { - t.Error(err) - return - } - - compiler, err := compile.New(rc, compile.Dev()) - if err != nil { - t.Error(err) - return - } - - err = compiler.Build() - if err != nil { - t.Error(err) - return - } - - err = compiler.Publish(tns) - if err != nil { - t.Error(err) - return - } - - test_obj, err := tns.Fetch(specs.ProjectPrefix(projectIface.Get().Id(), fakeMeta.Repository.Branch, fakeMeta.HeadCommit.ID)) - if test_obj.Interface() == nil { - t.Error("NO OBject found", err) - return - } - - maps.Display("", test_obj) - - testProjectDir := "./testGIT/testDecompileProd" - os.RemoveAll(testProjectDir) - os.Mkdir(testProjectDir, 0777) - - decompiler, err := decompile.New(afero.NewBasePathFs(afero.NewOsFs(), testProjectDir), test_obj.Interface()) - if err != nil { - t.Error(err) - return - } - - _, err = decompiler.Build() - if err != nil { - t.Error(err) - } - -} diff --git a/fixtures/dreamland.go b/fixtures/dreamland.go deleted file mode 100644 index 636ed13..0000000 --- a/fixtures/dreamland.go +++ /dev/null @@ -1,10 +0,0 @@ -package fixtures - -import ( - dreamlandRegistry "github.com/taubyte/tau/libdream/registry" -) - -func init() { - dreamlandRegistry.Fixture("fakeProject", fakeProject) - dreamlandRegistry.Fixture("injectProject", injectProject) -} diff --git a/fixtures/fake_project.go b/fixtures/fake_project.go deleted file mode 100644 index c5a07bc..0000000 --- a/fixtures/fake_project.go +++ /dev/null @@ -1,27 +0,0 @@ -package fixtures - -import ( - "fmt" - - "github.com/taubyte/config-compiler/fixtures" - "github.com/taubyte/tau/libdream/common" -) - -func fakeProject(u common.Universe, params ...interface{}) error { - simple, err := u.Simple("client") - if err != nil { - return fmt.Errorf("failed getting simple with error: %v", err) - } - - err = simple.Provides("tns") - if err != nil { - return err - } - - project, err := fixtures.Project() - if err != nil { - return err - } - - return inject(project, simple) -} diff --git a/fixtures/fake_project_test.go b/fixtures/fake_project_test.go deleted file mode 100644 index 8ce4215..0000000 --- a/fixtures/fake_project_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package fixtures - -import ( - "testing" - - commonIface "github.com/taubyte/go-interfaces/common" - _ "github.com/taubyte/tau/clients/p2p/tns" - commonDreamland "github.com/taubyte/tau/libdream/common" - dreamland "github.com/taubyte/tau/libdream/services" - _ "github.com/taubyte/tau/protocols/tns" -) - -func TestFakeProject(t *testing.T) { - t.Skip("needs to be reimplemented") - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "TestFakeProject"}) - defer u.Stop() - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{ - "tns": {}, - }, - Simples: map[string]commonDreamland.SimpleConfig{ - "client": { - Clients: commonDreamland.SimpleConfigClients{ - TNS: &commonIface.ClientConfig{}, - }, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - err = u.RunFixture("fakeProject") - if err != nil { - t.Error(err) - return - } -} diff --git a/fixtures/helpers_test.go b/fixtures/helpers_test.go deleted file mode 100644 index a564815..0000000 --- a/fixtures/helpers_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package fixtures - -import ( - commonTest "github.com/taubyte/tau/libdream/helpers" -) - -var ( - fakeMeta = commonTest.ConfigRepo.HookInfo -) - -func init() { - fakeMeta.Repository.Provider = "github" - fakeMeta.Repository.Branch = "master" -} diff --git a/fixtures/http_test.go b/fixtures/http_test.go deleted file mode 100644 index 8db6aad..0000000 --- a/fixtures/http_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package fixtures - -import ( - "os" - "testing" - - "github.com/taubyte/config-compiler/compile" - commonIface "github.com/taubyte/go-interfaces/common" - projectLib "github.com/taubyte/go-project-schema/project" - functionSpec "github.com/taubyte/go-specs/function" - websiteSpec "github.com/taubyte/go-specs/website" - commonDreamland "github.com/taubyte/tau/libdream/common" - commonTest "github.com/taubyte/tau/libdream/helpers" - gitTest "github.com/taubyte/tau/libdream/helpers/git" - dreamland "github.com/taubyte/tau/libdream/services" - _ "github.com/taubyte/tau/protocols/tns" -) - -func TestHttp(t *testing.T) { - t.Skip("using an old project") - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "scratch"}) - defer u.Stop() - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{ - "tns": {}, - }, - Simples: map[string]commonDreamland.SimpleConfig{ - "me": { - Clients: commonDreamland.SimpleConfigClients{ - TNS: &commonIface.ClientConfig{}, - }, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - simple, err := u.Simple("me") - if err != nil { - t.Error(err) - return - } - tns := simple.TNS() - - gitRoot := "./testGIT" - gitRootConfig := gitRoot + "/prodConfig" - os.MkdirAll(gitRootConfig, 0755) - - fakeMeta.Repository.SSHURL = "git@github.com:taubyte-test/tb_prodproject.git" - fakeMeta.Repository.Provider = "github" - - err = gitTest.CloneToDirSSH(u.Context(), gitRootConfig, commonTest.Repository{ - ID: 517160737, - Name: "tb_prodproject", - HookInfo: fakeMeta, - }) - if err != nil { - t.Error(err) - return - } - - // read with seer - projectIface, err := projectLib.Open(projectLib.SystemFS(gitRootConfig)) - if err != nil { - t.Error(err) - return - } - - rc, err := compile.CompilerConfig(projectIface, fakeMeta) - if err != nil { - t.Error(err) - return - } - - compiler, err := compile.New(rc, compile.Dev()) - if err != nil { - t.Error(err) - return - } - if err != nil { - t.Error(err) - return - } - defer compiler.Close() - - err = compiler.Build() - if err != nil { - t.Error(err) - return - } - - err = compiler.Publish(tns) - if err != nil { - t.Error(err) - return - } - - _path, err := websiteSpec.Tns().HttpPath("skelouse.com") - if err != nil { - t.Error(err) - return - } - - links := _path.Versioning().Links() - test_obj, err := tns.Fetch(links) - if test_obj == nil { - t.Error("NO Object found", err) - return - } - - _path, err = functionSpec.Tns().HttpPath("pong.tau.link") - if err != nil { - t.Error(err) - return - } - - links = _path.Versioning().Links() - test_obj, err = tns.Fetch(links) - if test_obj == nil { - t.Error("NO OBject found", err) - return - } - - currentPaths, err := test_obj.Current(fakeMeta.Repository.Branch) - if err != nil || len(currentPaths) < 1 { - t.Error("No paths found", err) - return - } - - for _, path := range currentPaths { - currentObj, err := tns.Fetch(path) - if err != nil { - t.Error(err) - return - } - - if currentObj.Interface() == nil { - t.Error("expected non nil object") - return - } - } -} diff --git a/fixtures/import_prod_project.go b/fixtures/import_prod_project.go deleted file mode 100644 index eecab6c..0000000 --- a/fixtures/import_prod_project.go +++ /dev/null @@ -1,221 +0,0 @@ -package fixtures - -import ( - "errors" - "fmt" - "reflect" - "sync" - "time" - - "github.com/taubyte/go-interfaces/services/patrick" - spec "github.com/taubyte/go-specs/common" - commonDreamland "github.com/taubyte/tau/libdream/common" - "github.com/taubyte/tau/libdream/helpers" - dreamlandRegistry "github.com/taubyte/tau/libdream/registry" -) - -func init() { - dreamlandRegistry.Fixture("importProdProject", importProdProject) -} - -type repo struct { - branch string - repository_id string - repository_name string -} - -func walkObject(r reflect.Value, repoCan chan repo) { - if r.Kind() != reflect.Map { - if r.Elem().Kind() != reflect.Map { - return - } - r = r.Elem() - } - - rid := r.MapIndex(reflect.ValueOf("repository-id")) - rn := r.MapIndex(reflect.ValueOf("repository-name")) - branch := r.MapIndex(reflect.ValueOf("branch")) - - if rid.IsValid() && rn.IsValid() && branch.IsValid() && rid.Elem().IsValid() && rn.Elem().IsValid() && branch.Elem().IsValid() { - repoCan <- repo{ - branch: branch.Elem().String(), - repository_id: rid.Elem().String(), - repository_name: rn.Elem().String(), - } - return - } - - var wg sync.WaitGroup - for _, k := range r.MapKeys() { - wg.Add(1) - go func(k reflect.Value) { - walkObject(r.MapIndex(k), repoCan) - wg.Done() - }(k) - } - wg.Wait() -} - -func importProdProject(u commonDreamland.Universe, params ...interface{}) error { - if len(params) < 2 { - return errors.New("importProdProject expects 2-3 parameters [project-id] [git-token] (branch)") - } - - projectId := params[0].(string) - if len(projectId) > 0 { - helpers.ProjectID = projectId - } - gitToken := params[1].(string) - if len(gitToken) > 0 { - helpers.GitToken = gitToken - } - - branch := "" - if len(params) > 2 { - branch = params[2].(string) - } - - if len(branch) > 0 { - helpers.Branch = branch - } - // Tracking how many jobs we run so that we can confirm we are waiting - // for the right number of jobs to run - var numJobs int - - err := attachProdProject(u, projectId, gitToken) - if err != nil { - return err - } - - if SharedRepositoryData == nil { - return fmt.Errorf("attaching prod project failed somehow") - } - - simple, err := u.Simple("client") - if err != nil { - return err - } - - time.Sleep(1 * time.Second) - - numJobs++ - err = u.RunFixture("pushSpecific", SharedRepositoryData.Configuration.Id, SharedRepositoryData.Configuration.Fullname, projectId, helpers.Branch) - if err != nil { - return err - } - - tnsClient := simple.TNS() - var wg sync.WaitGroup - wg.Add(1) - go func() { - defer wg.Done() - <-time.After(time.Second) - if _, err := tnsClient.Fetch(spec.Current(projectId, helpers.Branch)); err != nil { - return - } - }() - wg.Wait() - - numJobs++ - err = u.RunFixture("pushSpecific", SharedRepositoryData.Code.Id, SharedRepositoryData.Code.Fullname, projectId, helpers.Branch) - if err != nil { - return err - } - - patrickClient := simple.Patrick() - jobs, err := patrickClient.List() - if err != nil { - return err - } - - // Wait for config job to be done within 15 seconds - maxAttempts := 15 - var attempts int - for attempts < maxAttempts { - configJob := jobs[0] - job, err := patrickClient.Get(configJob) - if err != nil { - return err - } - - time.Sleep(1 * time.Second) - if job.Status == patrick.JobStatusSuccess { - break - } - - attempts++ - } - - project, err := tnsClient.Simple().Project(projectId, helpers.Branch) - if err != nil { - return err - } - - rProject := reflect.ValueOf(project) - - repoCan := make(chan repo, 64) - - go func() { - walkObject(rProject, repoCan) - close(repoCan) - }() - - for r := range repoCan { - numJobs++ - err = u.RunFixture("pushSpecific", r.repository_id, r.repository_name, projectId, helpers.Branch) - if err != nil { - return err - } - } - - var patrickJobs []string - - // Wait for all jobs to be on patrick - maxAttempts = 30 - attempts = 0 - for attempts < maxAttempts { - patrickJobs, _ = patrickClient.List() - - if len(patrickJobs) == numJobs { - break - } - - time.Sleep(1 * time.Second) - attempts++ - } - - if len(patrickJobs) != numJobs { - return fmt.Errorf("all jobs didn't make it to patrick, got: %d expected %d", len(patrickJobs), numJobs) - } - - // Wait for all jobs to finish - maxAttempts = 300 - attempts = 0 - - var failure bool - for attempts < maxAttempts { - failure = false - for _, jid := range patrickJobs { - job, _ := patrickClient.Get(jid) - - if job != nil { - if job.Status != patrick.JobStatusSuccess { - failure = true - } - } - } - - if !failure { - break - } - - time.Sleep(1 * time.Second) - attempts++ - } - - if failure { - return errors.New("not all jobs succeeded after 5 minutes") - } - - return nil -} diff --git a/fixtures/import_prod_project_test.go b/fixtures/import_prod_project_test.go deleted file mode 100644 index 3124e40..0000000 --- a/fixtures/import_prod_project_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package fixtures - -import ( - "testing" - - commonIface "github.com/taubyte/go-interfaces/common" - spec "github.com/taubyte/go-specs/common" - commonDreamland "github.com/taubyte/tau/libdream/common" - "github.com/taubyte/tau/libdream/helpers" - dreamland "github.com/taubyte/tau/libdream/services" - _ "github.com/taubyte/tau/protocols/auth" - _ "github.com/taubyte/tau/protocols/monkey" - _ "github.com/taubyte/tau/protocols/patrick" - _ "github.com/taubyte/tau/protocols/tns" -) - -func TestImportProdProject(t *testing.T) { - t.Skip("currently custom domains do not work on dreamland") - - spec.DefaultBranch = "master_test" - - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "TestImportProdProject"}) - defer u.Stop() - - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{ - "auth": {}, - "tns": {}, - "monkey": {}, - "patrick": {}, - "hoarder": {}, - }, - Simples: map[string]commonDreamland.SimpleConfig{ - "client": { - Clients: commonDreamland.SimpleConfigClients{ - TNS: &commonIface.ClientConfig{}, - Auth: &commonIface.ClientConfig{}, - Patrick: &commonIface.ClientConfig{}, - }, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - err = u.RunFixture("importProdProject", "QmYfMsCDvC9geoRRMCwRxvW1XSn3VQQoevBC48D9scmLJX", helpers.GitToken, "master_test") - if err != nil { - t.Error(err) - return - } -} diff --git a/fixtures/indexer_test.go b/fixtures/indexer_test.go deleted file mode 100644 index d25feb0..0000000 --- a/fixtures/indexer_test.go +++ /dev/null @@ -1,96 +0,0 @@ -package fixtures - -import ( - "testing" - - "github.com/taubyte/config-compiler/compile" - testFixtures "github.com/taubyte/config-compiler/fixtures" - commonIface "github.com/taubyte/go-interfaces/common" - "github.com/taubyte/go-interfaces/services/tns" - projectSchema "github.com/taubyte/go-project-schema/project" - commonDreamland "github.com/taubyte/tau/libdream/common" - dreamland "github.com/taubyte/tau/libdream/services" - maps "github.com/taubyte/utils/maps" -) - -func TestIndexer(t *testing.T) { - t.Skip("needs to be reimplemented") - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "indexer"}) - defer u.Stop() - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{ - "tns": {}, - }, - Simples: map[string]commonDreamland.SimpleConfig{ - "client": { - Clients: commonDreamland.SimpleConfigClients{ - TNS: &commonIface.ClientConfig{}, - }, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - simple, err := u.Simple("client") - if err != nil { - t.Error(err) - return - } - - fs, err := testFixtures.VirtualFSWithBuiltProject() - if err != nil { - t.Error(err) - return - } - - project, err := projectSchema.Open(projectSchema.VirtualFS(fs, "/test_project/config")) - if err != nil { - t.Error(err) - return - } - - rc, err := compile.CompilerConfig(project, fakeMeta) - if err != nil { - t.Error(err) - return - } - - compiler, err := compile.New(rc, compile.Dev()) - if err != nil { - t.Error(err) - return - } - - err = compiler.Build() - if err != nil { - t.Error(err) - return - } - - err = compiler.Publish(simple.TNS()) - if err != nil { - t.Error(err) - return - } - - resp, err := simple.TNS().Lookup(tns.Query{Prefix: []string{"domains"}, RegEx: false}) - if err != nil { - t.Error(err) - return - } - - _map := make(map[string]interface{}) - _map["test"] = resp - list, err := maps.StringArray(_map, "test") - if err != nil { - t.Error(err) - return - } - - if len(list) != 2 { // local/global domains index, project,branch - t.Errorf("Expected 2 got %d", len(list)) - } -} diff --git a/fixtures/inject_project.go b/fixtures/inject_project.go deleted file mode 100644 index b9cce04..0000000 --- a/fixtures/inject_project.go +++ /dev/null @@ -1,27 +0,0 @@ -package fixtures - -import ( - "fmt" - - "github.com/taubyte/go-project-schema/project" - "github.com/taubyte/tau/libdream/common" -) - -func injectProject(u common.Universe, params ...interface{}) error { - simple, err := u.Simple("client") - if err != nil { - return fmt.Errorf("failed getting simple with error: %v", err) - } - - err = simple.Provides("tns") - if err != nil { - return err - } - - project, ok := params[0].(project.Project) - if !ok { - return fmt.Errorf("param 0 not a valid project to inject got %T", params[0]) - } - - return inject(project, simple) -} diff --git a/fixtures/publish_test.go b/fixtures/publish_test.go deleted file mode 100644 index fd9357a..0000000 --- a/fixtures/publish_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package fixtures - -import ( - "testing" - - "github.com/taubyte/config-compiler/compile" - testFixtures "github.com/taubyte/config-compiler/fixtures" - commonIface "github.com/taubyte/go-interfaces/common" - projectSchema "github.com/taubyte/go-project-schema/project" - specs "github.com/taubyte/go-specs/methods" - commonDreamland "github.com/taubyte/tau/libdream/common" - "github.com/taubyte/tau/libdream/services" - - _ "github.com/taubyte/tau/protocols/tns" -) - -func TestUpdate(t *testing.T) { - t.Skip("needs to be reimplemented") - u := services.Multiverse(services.UniverseConfig{Name: "single_e2e"}) - defer u.Stop() - - err := u.StartWithConfig(&commonDreamland.Config{ - Services: map[string]commonIface.ServiceConfig{ - "tns": {}, - }, - Simples: map[string]commonDreamland.SimpleConfig{ - "client": { - Clients: commonDreamland.SimpleConfigClients{ - TNS: &commonIface.ClientConfig{}, - }, - }, - }, - }) - if err != nil { - t.Error(err) - return - } - - simple, err := u.Simple("client") - if err != nil { - t.Error(err) - return - } - tns := simple.TNS() - - fs, err := testFixtures.VirtualFSWithBuiltProject() - if err != nil { - t.Error(err) - return - } - - project, err := projectSchema.Open(projectSchema.VirtualFS(fs, "/test_project/config")) - if err != nil { - t.Error(err) - return - } - - rc, err := compile.CompilerConfig(project, fakeMeta) - if err != nil { - t.Error(err) - return - } - - compiler, err := compile.New(rc, compile.Dev()) - if err != nil { - t.Error(err) - return - } - defer compiler.Close() - - err = compiler.Build() - if err != nil { - t.Error(err) - return - } - - err = compiler.Publish(tns) - if err != nil { - t.Error(err) - return - } - - _, err = tns.Fetch(specs.ProjectPrefix(project.Get().Id(), fakeMeta.Repository.Branch, fakeMeta.HeadCommit.ID)) - if err != nil { - t.Error(err) - return - } - - // TODO: Need to reimplement this check - - // if reflect.DeepEqual(new_obj.Interface(), cc.CreatedProjectObject) == false { - // maps.Display("", new_obj.Interface()) - // fmt.Print("\n\n\n\n\n\n") - // maps.Display("", createdProjectObject) - // t.Error("Objects not equal") - // return - // } -} diff --git a/go.mod b/go.mod index d577e51..e16df7c 100644 --- a/go.mod +++ b/go.mod @@ -2,20 +2,17 @@ module github.com/taubyte/dreamland go 1.19 +replace github.com/taubyte/tau => ../tau + require ( - github.com/google/go-github v17.0.0+incompatible github.com/jedib0t/go-pretty/v6 v6.4.6 github.com/pterm/pterm v0.12.62 - github.com/spf13/afero v1.9.5 - github.com/taubyte/config-compiler v0.4.5 - github.com/taubyte/go-interfaces v0.2.9 - github.com/taubyte/go-project-schema v0.9.3 + github.com/taubyte/go-interfaces v0.2.10 github.com/taubyte/go-specs v0.10.5 github.com/taubyte/http v0.10.3 github.com/taubyte/tau v0.0.0-20230728185337-876124b14a81 github.com/taubyte/utils v0.1.6 github.com/urfave/cli/v2 v2.25.7 - golang.org/x/oauth2 v0.10.0 ) require ( @@ -78,6 +75,7 @@ require ( github.com/golang/mock v1.6.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/google/go-github v17.0.0+incompatible // indirect github.com/google/go-github/v32 v32.1.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gopacket v1.1.19 // indirect @@ -206,8 +204,11 @@ require ( github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect + github.com/spf13/afero v1.9.5 // indirect github.com/taubyte/builder v0.0.0-20230714181048-6ea47db67d29 // indirect + github.com/taubyte/config-compiler v0.4.5 // indirect github.com/taubyte/domain-validation v1.0.0 // indirect + github.com/taubyte/go-project-schema v0.9.3 // indirect github.com/taubyte/go-sdk v0.3.8 // indirect github.com/taubyte/go-sdk-smartops v0.1.3 // indirect github.com/taubyte/go-seer v1.0.6 // indirect @@ -244,6 +245,7 @@ require ( golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect golang.org/x/mod v0.12.0 // indirect golang.org/x/net v0.12.0 // indirect + golang.org/x/oauth2 v0.10.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.10.0 // indirect golang.org/x/term v0.10.0 // indirect diff --git a/go.sum b/go.sum index 37bc261..0de684a 100644 --- a/go.sum +++ b/go.sum @@ -881,8 +881,8 @@ github.com/taubyte/config-compiler v0.4.5 h1:s7f6Jb/sJgC6C4ZIHOvctMgmXjz/Q58FnLc github.com/taubyte/config-compiler v0.4.5/go.mod h1:gaohk1BSknIudo16QSgeQqVWVGLyusPPdLn+wQ+xAmY= github.com/taubyte/domain-validation v1.0.0 h1:yUt6y7b/3PC9aocvl7s8cBKG4ieN35zQqVQIywGUg4o= github.com/taubyte/domain-validation v1.0.0/go.mod h1:/X3yd7sBjnE323rA8I9PiUt5+NlKU4I02nQik25Vqe8= -github.com/taubyte/go-interfaces v0.2.9 h1:O3t3xuPMYc80TEzCJdMiQnJBy0yMj6Er0xh91eKHsOo= -github.com/taubyte/go-interfaces v0.2.9/go.mod h1:ED75qRg7642RhL9SF12rtrvxPhxuUJVbAnaHIkUv92k= +github.com/taubyte/go-interfaces v0.2.10 h1:tE3StW123SQiJcIRaan0WzlbubsAjivbRj/ToQlvPhs= +github.com/taubyte/go-interfaces v0.2.10/go.mod h1:G5ZCOs2lbR39T9+6gkV4jYTgAnLx9P/uRIJXkT/ix6E= github.com/taubyte/go-project-schema v0.9.3 h1:2H0ClUZq7f97OgtL0FUe9tv2v12wOmnTAIiJGLei/gU= github.com/taubyte/go-project-schema v0.9.3/go.mod h1:8Rt5zsVfj8qbYCT+7++oax/nFVKvVfAepzVkqXrNTs8= github.com/taubyte/go-sdk v0.3.8 h1:RIg7N+ccIwTwqPopRMCrKgGhVigN1tPTCi1JG/mm4fg= @@ -902,8 +902,6 @@ github.com/taubyte/http v0.10.3/go.mod h1:iYTdJl6dk3m1tC6H5WAJRX/R81ROwy7cg++zaz github.com/taubyte/odo v0.0.0-20230727154809-0688a5d7674b h1:2Jt0GOC/2OoSG8R+SG8ctWD1m8XVla3IMb4Z69QIZLg= github.com/taubyte/p2p v0.9.1 h1:W8whhWbYO5oCqOSUM+gNKCERtVGmTJHTZuTw+MJuswg= github.com/taubyte/p2p v0.9.1/go.mod h1:0vWZjiX8yNT3VwZO2x+mgRdEDCbwzSPOyyfBU3UEiTk= -github.com/taubyte/tau v0.0.0-20230728185337-876124b14a81 h1:QAGlsOqq6VRWHZjQH1P0q5NRQfpeSeaH5p/BJ26p+Sc= -github.com/taubyte/tau v0.0.0-20230728185337-876124b14a81/go.mod h1:Oz3n9Zn5HaHUFRXjxP0dhdjeeL11HCHTJbjHybx0h6M= github.com/taubyte/tau-cli v0.1.8 h1:81VcK9ZfKoAwzjwhnxQkxXa/kjv9fyb4kUephaqcxa0= github.com/taubyte/tau-cli v0.1.8/go.mod h1:4BC0INT2qB3RnDVooAPuc8XWu7trU4smhJ/XdhKjYkA= github.com/taubyte/utils v0.1.6 h1:bRSJZW/8E/wpT3wwyU3C97M9ddAJ52AfXFeP47JRGsY= diff --git a/main.go b/main.go index ed31f49..c30734d 100644 --- a/main.go +++ b/main.go @@ -23,13 +23,13 @@ import ( "github.com/urfave/cli/v2" // Empty imports for initializing fixtures, and client/service run methods" - _ "github.com/taubyte/dreamland/fixtures" _ "github.com/taubyte/tau/clients/p2p/auth" _ "github.com/taubyte/tau/clients/p2p/hoarder" _ "github.com/taubyte/tau/clients/p2p/monkey" _ "github.com/taubyte/tau/clients/p2p/patrick" _ "github.com/taubyte/tau/clients/p2p/seer" _ "github.com/taubyte/tau/clients/p2p/tns" + _ "github.com/taubyte/tau/libdream/common/fixtures" _ "github.com/taubyte/tau/protocols/auth" _ "github.com/taubyte/tau/protocols/hoarder" _ "github.com/taubyte/tau/protocols/monkey" diff --git a/service/universe_test.go b/service/universe_test.go index 2df3b9b..2c092f2 100644 --- a/service/universe_test.go +++ b/service/universe_test.go @@ -32,7 +32,7 @@ func TestRoutes(t *testing.T) { return } - u := dreamland.Multiverse(dreamland.UniverseConfig{Name: "dreamland-http"}) + u := dreamland.Multiverse(dreamland.UniverseConfig{Name: t.Name()}) defer u.Stop() err = u.StartWithConfig(&commonDreamland.Config{ From 7ca55cf54ff92596b7d47c8111b2811df15be6cc Mon Sep 17 00:00:00 2001 From: samyfodil Date: Sun, 30 Jul 2023 23:31:55 -0500 Subject: [PATCH 4/4] nits --- LICENSE | 11 +++++++++++ README.md | 9 +++++++++ go.mod | 14 ++++++-------- go.sum | 22 ++++++++++++---------- 4 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 LICENSE create mode 100644 README.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5ca5974 --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright 2020 Taubyte + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e15f89 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# dreamland + +[![Release](https://img.shields.io/github/release/taubyte/dreamland.svg)](https://github.com/taubyte/dreamland/releases) +[![License](https://img.shields.io/github/license/taubyte/dreamland)](LICENSE) +[![Go Report Card](https://goreportcard.com/badge/taubyte/dreamland)](https://goreportcard.com/report/taubyte/dreamland) +[![GoDoc](https://godoc.org/github.com/taubyte/dreamland?status.svg)](https://pkg.go.dev/github.com/taubyte/dreamland) +[![Discord](https://img.shields.io/discord/973677117722202152?color=%235865f2&label=discord)](https://discord.gg/taubyte) + +`dreamland` is a tool that let you run a full Taubyte-based Cloud locally. Documentation: [https://tau.how](https://tau.how). diff --git a/go.mod b/go.mod index e16df7c..a6678c1 100644 --- a/go.mod +++ b/go.mod @@ -2,15 +2,13 @@ module github.com/taubyte/dreamland go 1.19 -replace github.com/taubyte/tau => ../tau - require ( github.com/jedib0t/go-pretty/v6 v6.4.6 github.com/pterm/pterm v0.12.62 - github.com/taubyte/go-interfaces v0.2.10 - github.com/taubyte/go-specs v0.10.5 + github.com/taubyte/go-interfaces v0.2.11 + github.com/taubyte/go-specs v0.10.6 github.com/taubyte/http v0.10.3 - github.com/taubyte/tau v0.0.0-20230728185337-876124b14a81 + github.com/taubyte/tau v1.0.0 github.com/taubyte/utils v0.1.6 github.com/urfave/cli/v2 v2.25.7 ) @@ -205,11 +203,11 @@ require ( github.com/sirupsen/logrus v1.9.0 // indirect github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.9.5 // indirect - github.com/taubyte/builder v0.0.0-20230714181048-6ea47db67d29 // indirect - github.com/taubyte/config-compiler v0.4.5 // indirect + github.com/taubyte/builder v0.2.0 // indirect + github.com/taubyte/config-compiler v0.4.6 // indirect github.com/taubyte/domain-validation v1.0.0 // indirect github.com/taubyte/go-project-schema v0.9.3 // indirect - github.com/taubyte/go-sdk v0.3.8 // indirect + github.com/taubyte/go-sdk v0.3.9 // indirect github.com/taubyte/go-sdk-smartops v0.1.3 // indirect github.com/taubyte/go-seer v1.0.6 // indirect github.com/taubyte/go-simple-container v0.4.2 // indirect diff --git a/go.sum b/go.sum index 0de684a..ae53029 100644 --- a/go.sum +++ b/go.sum @@ -875,18 +875,18 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= -github.com/taubyte/builder v0.0.0-20230714181048-6ea47db67d29 h1:3YjOrKOx3wSNqtSJz2dfJqmfgsAqd90JSzhD3QMWwbE= -github.com/taubyte/builder v0.0.0-20230714181048-6ea47db67d29/go.mod h1:McWLSLqcH2HnovV6uzeBb4EwceMaA5y/n0xCptkZuQM= -github.com/taubyte/config-compiler v0.4.5 h1:s7f6Jb/sJgC6C4ZIHOvctMgmXjz/Q58FnLcqTjAOF2g= -github.com/taubyte/config-compiler v0.4.5/go.mod h1:gaohk1BSknIudo16QSgeQqVWVGLyusPPdLn+wQ+xAmY= +github.com/taubyte/builder v0.2.0 h1:2L2AGG/o3bfhE/EleMFs3DCuy36ugSJY1qnvu38dZJM= +github.com/taubyte/builder v0.2.0/go.mod h1:McWLSLqcH2HnovV6uzeBb4EwceMaA5y/n0xCptkZuQM= +github.com/taubyte/config-compiler v0.4.6 h1:9s3xn955imE7gAyVFpcsBEkowhCir78b1HPWLcDAl38= +github.com/taubyte/config-compiler v0.4.6/go.mod h1:gaohk1BSknIudo16QSgeQqVWVGLyusPPdLn+wQ+xAmY= github.com/taubyte/domain-validation v1.0.0 h1:yUt6y7b/3PC9aocvl7s8cBKG4ieN35zQqVQIywGUg4o= github.com/taubyte/domain-validation v1.0.0/go.mod h1:/X3yd7sBjnE323rA8I9PiUt5+NlKU4I02nQik25Vqe8= -github.com/taubyte/go-interfaces v0.2.10 h1:tE3StW123SQiJcIRaan0WzlbubsAjivbRj/ToQlvPhs= -github.com/taubyte/go-interfaces v0.2.10/go.mod h1:G5ZCOs2lbR39T9+6gkV4jYTgAnLx9P/uRIJXkT/ix6E= +github.com/taubyte/go-interfaces v0.2.11 h1:39ixGdOXM7BNplGGfHdPJpN1mOuPB9h5IHNaxazLGf4= +github.com/taubyte/go-interfaces v0.2.11/go.mod h1:G5ZCOs2lbR39T9+6gkV4jYTgAnLx9P/uRIJXkT/ix6E= github.com/taubyte/go-project-schema v0.9.3 h1:2H0ClUZq7f97OgtL0FUe9tv2v12wOmnTAIiJGLei/gU= github.com/taubyte/go-project-schema v0.9.3/go.mod h1:8Rt5zsVfj8qbYCT+7++oax/nFVKvVfAepzVkqXrNTs8= -github.com/taubyte/go-sdk v0.3.8 h1:RIg7N+ccIwTwqPopRMCrKgGhVigN1tPTCi1JG/mm4fg= -github.com/taubyte/go-sdk v0.3.8/go.mod h1:WGMYl7JzjnVbTJbGUpXNFCh27jNg/oqZL1Sbh8+fOgo= +github.com/taubyte/go-sdk v0.3.9 h1:mwwjiub/Jc987kfWvVfAcx63fMRAYB9cj4yhJq+CSyo= +github.com/taubyte/go-sdk v0.3.9/go.mod h1:N4D4A6bdIfsF13z0jsJ7QJ7XGuoWLOz6LHae9X1vg7E= github.com/taubyte/go-sdk-smartops v0.1.3 h1:q66gwuZibMI9tN6RAn4K1KTXPfKXEG3DgQRPBTHWBdk= github.com/taubyte/go-sdk-smartops v0.1.3/go.mod h1:EXyWD6gVwWDoc/qtlSqFnxoYBrSD0PqBct5dY/kV8H4= github.com/taubyte/go-seer v1.0.6 h1:7T6rUTlnQDsON/eUQBTgsmAzpP7gE2SFcBsgsQr9bZc= @@ -895,13 +895,15 @@ github.com/taubyte/go-simple-container v0.4.2 h1:WMC/kgubrQiiDzMfLs3X0WcAMl9hkVO github.com/taubyte/go-simple-container v0.4.2/go.mod h1:7nFas4yr17+jFUWmQLBNZ//s40Y+7/iiJhJkXAJDGiY= github.com/taubyte/go-simple-git v0.2.5 h1:ESwhDVHGF0oVPFtZvCS5SzrugjCpK0KKaQIQC6AxzDE= github.com/taubyte/go-simple-git v0.2.5/go.mod h1:tPUTQo7GPNEYOV1kRMqWLv3cihLN4MKyK1kW36xr9wk= -github.com/taubyte/go-specs v0.10.5 h1:R3eli3cpiw5WKMoO8MzO0+sk72LGTQXWSxUoWN7vswE= -github.com/taubyte/go-specs v0.10.5/go.mod h1:HWMNhpmQzy/1Eg6s5TICKl+/talTXLX6jYEUuWCsaGg= +github.com/taubyte/go-specs v0.10.6 h1:iSy5gJ6qpEICNKdQsyG9BiFn0Pf3/SgYk/P5rbHIpR8= +github.com/taubyte/go-specs v0.10.6/go.mod h1:HWMNhpmQzy/1Eg6s5TICKl+/talTXLX6jYEUuWCsaGg= github.com/taubyte/http v0.10.3 h1:UUfDVllEgDE7qD0CPPBXd2+jjbTH5If2f/1G3//9d7A= github.com/taubyte/http v0.10.3/go.mod h1:iYTdJl6dk3m1tC6H5WAJRX/R81ROwy7cg++zazkOqcY= github.com/taubyte/odo v0.0.0-20230727154809-0688a5d7674b h1:2Jt0GOC/2OoSG8R+SG8ctWD1m8XVla3IMb4Z69QIZLg= github.com/taubyte/p2p v0.9.1 h1:W8whhWbYO5oCqOSUM+gNKCERtVGmTJHTZuTw+MJuswg= github.com/taubyte/p2p v0.9.1/go.mod h1:0vWZjiX8yNT3VwZO2x+mgRdEDCbwzSPOyyfBU3UEiTk= +github.com/taubyte/tau v1.0.0 h1:J/OYb5MvXhIgiFUR49wBXIheVNGhqz1dIYqzHc9+0MI= +github.com/taubyte/tau v1.0.0/go.mod h1:mpZRSs3DEhdFg10+Qk8I3CQwz3w9l2GGhUQFHO+khoc= github.com/taubyte/tau-cli v0.1.8 h1:81VcK9ZfKoAwzjwhnxQkxXa/kjv9fyb4kUephaqcxa0= github.com/taubyte/tau-cli v0.1.8/go.mod h1:4BC0INT2qB3RnDVooAPuc8XWu7trU4smhJ/XdhKjYkA= github.com/taubyte/utils v0.1.6 h1:bRSJZW/8E/wpT3wwyU3C97M9ddAJ52AfXFeP47JRGsY=