Skip to content

Commit

Permalink
Added service and switched to AppGate
Browse files Browse the repository at this point in the history
  • Loading branch information
Olshansk committed Nov 11, 2023
1 parent f074f97 commit 34e52f7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

POKTROLLD_HOME := ./localnet/poktrolld
POCKET_NODE = tcp://127.0.0.1:36657 # The pocket rollup node (full node and sequencer in the localnet context)
RELAYER_NODE = http://anvil:8547 # TODO_IN_THIS_COMMIT: UPDATE THIS URL
APPGATE_SERVER = http://localhost:42069
POCKET_ADDR_PREFIX = pokt

####################
Expand Down Expand Up @@ -137,7 +137,7 @@ go_imports: check_go_version ## Run goimports on all go files
.PHONY: test_e2e
test_e2e: ## Run all E2E tests
export POCKET_NODE=$(POCKET_NODE) && \
export RELAYER_NODE=$(RELAYER_NODE) && \
export APPGATE_SERVER=$(APPGATE_SERVER) && \
POKTROLLD_HOME=../../$(POKTROLLD_HOME) && \
go test -v ./e2e/tests/... -tags=e2e

Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName st
}

func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, requestData string) {
res, err := s.pocketd.RunCurl("", requestData)
res, err := s.pocketd.RunCurl("", serviceId, requestData)
if err != nil {
s.Fatalf("error sending relay request from app %s to supplier %s for service %s: %v", appName, supplierName, serviceId, err)
}
Expand Down
16 changes: 8 additions & 8 deletions e2e/tests/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var (
defaultRPCHost = "127.0.0.1"
// defaultHome is the default home directory for pocketd
defaultHome = os.Getenv("POKTROLLD_HOME")
// defaultRelayerURL used by curl commands to send relay requests
defaultRelayerURL = os.Getenv("RELAYER_NODE")
// defaultAppGateServerURL used by curl commands to send relay requests
defaultAppGateServerURL = os.Getenv("APPGATE_SERVER")
)

func init() {
Expand All @@ -46,7 +46,7 @@ type commandResult struct {
type PocketClient interface {
RunCommand(args ...string) (*commandResult, error)
RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error)
RunCurl(rpcUrl string, data string, args ...string) (*commandResult, error)
RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error)
}

// Ensure that pocketdBin struct fulfills PocketClient
Expand All @@ -72,11 +72,11 @@ func (p *pocketdBin) RunCommandOnHost(rpcUrl string, args ...string) (*commandRe
}

// RunCurl runs a curl command on the local machine
func (p *pocketdBin) RunCurl(rpcUrl string, data string, args ...string) (*commandResult, error) {
func (p *pocketdBin) RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) {
if rpcUrl == "" {
rpcUrl = defaultRelayerURL
rpcUrl = defaultAppGateServerURL
}
return p.runCurlPostCmd(rpcUrl, data, args...)
return p.runCurlPostCmd(rpcUrl, service, data, args...)
}

// runPocketCmd is a helper to run a command using the local pocketd binary with the flags provided
Expand Down Expand Up @@ -108,8 +108,8 @@ func (p *pocketdBin) runPocketCmd(args ...string) (*commandResult, error) {
}

// runCurlPostCmd is a helper to run a command using the local pocketd binary with the flags provided
func (p *pocketdBin) runCurlPostCmd(rpcUrl string, data string, args ...string) (*commandResult, error) {
base := []string{"-v", "-X", "POST", "-H", "'Content-Type: application/json'", "--data", fmt.Sprintf("'%s'", data), rpcUrl}
func (p *pocketdBin) runCurlPostCmd(rpcUrl string, service string, data string, args ...string) (*commandResult, error) {
base := []string{"-v", "-X", "POST", "-H", "'Content-Type: application/json'", "--data", fmt.Sprintf("'%s'", data), fmt.Sprintf("%s/%s", rpcUrl, service)}
args = append(base, args...)
commandStr := "curl " + strings.Join(args, " ") // Create a string representation of the command
cmd := exec.Command("curl", args...)
Expand Down
2 changes: 1 addition & 1 deletion pkg/appgateserver/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ func setupAppGateServerDependencies(cmd *cobra.Command, ctx context.Context, com
return nil, fmt.Errorf("failed to create block client: %w", err)
}

// Return the dependencie config.
// Return the dependencies config.
return depinject.Supply(clientCtx, blockClient), nil
}

0 comments on commit 34e52f7

Please sign in to comment.