Skip to content

Commit

Permalink
feat: introduce test-suite (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
themantre authored Dec 30, 2024
1 parent be94a18 commit c046fcb
Show file tree
Hide file tree
Showing 68 changed files with 417 additions and 197 deletions.
12 changes: 6 additions & 6 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"strings"

"github.com/pactus-project/pactus/crypto"
pagu "github.com/pagu-project/Pagu"
pagucmd "github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/Pagu/config"
"github.com/pagu-project/Pagu/internal/engine"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/pkg/log"
"github.com/pagu-project/pagu"
pagucmd "github.com/pagu-project/pagu/cmd"
"github.com/pagu-project/pagu/config"
"github.com/pagu-project/pagu/internal/engine"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/pkg/log"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/discord/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
pagu "github.com/pagu-project/Pagu"
"github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/pagu"
"github.com/pagu-project/pagu/cmd"
"github.com/spf13/cobra"
)

Expand Down
10 changes: 5 additions & 5 deletions cmd/discord/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os/signal"
"syscall"

pagucmd "github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/Pagu/config"
"github.com/pagu-project/Pagu/internal/engine"
"github.com/pagu-project/Pagu/internal/platforms/discord"
"github.com/pagu-project/Pagu/pkg/log"
pagucmd "github.com/pagu-project/pagu/cmd"
"github.com/pagu-project/pagu/config"
"github.com/pagu-project/pagu/internal/engine"
"github.com/pagu-project/pagu/internal/platforms/discord"
"github.com/pagu-project/pagu/pkg/log"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/grpc/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
pagu "github.com/pagu-project/Pagu"
"github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/pagu"
"github.com/pagu-project/pagu/cmd"
"github.com/spf13/cobra"
)

Expand Down
10 changes: 5 additions & 5 deletions cmd/grpc/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os/signal"
"syscall"

pagucmd "github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/Pagu/config"
"github.com/pagu-project/Pagu/internal/delivery/grpc"
"github.com/pagu-project/Pagu/internal/engine"
"github.com/pagu-project/Pagu/pkg/log"
pagucmd "github.com/pagu-project/pagu/cmd"
"github.com/pagu-project/pagu/config"
"github.com/pagu-project/pagu/internal/delivery/grpc"
"github.com/pagu-project/pagu/internal/engine"
"github.com/pagu-project/pagu/pkg/log"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/http/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
pagu "github.com/pagu-project/Pagu"
"github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/pagu"
"github.com/pagu-project/pagu/cmd"
"github.com/spf13/cobra"
)

Expand Down
10 changes: 5 additions & 5 deletions cmd/http/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os/signal"
"syscall"

pagucmd "github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/Pagu/config"
"github.com/pagu-project/Pagu/internal/delivery/http"
"github.com/pagu-project/Pagu/internal/engine"
"github.com/pagu-project/Pagu/pkg/log"
pagucmd "github.com/pagu-project/pagu/cmd"
"github.com/pagu-project/pagu/config"
"github.com/pagu-project/pagu/internal/delivery/http"
"github.com/pagu-project/pagu/internal/engine"
"github.com/pagu-project/pagu/pkg/log"
"github.com/spf13/cobra"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/telegram/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
pagu "github.com/pagu-project/Pagu"
"github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/pagu"
"github.com/pagu-project/pagu/cmd"
"github.com/spf13/cobra"
)

Expand Down
10 changes: 5 additions & 5 deletions cmd/telegram/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os/signal"
"syscall"

pagucmd "github.com/pagu-project/Pagu/cmd"
"github.com/pagu-project/Pagu/config"
"github.com/pagu-project/Pagu/internal/engine"
"github.com/pagu-project/Pagu/internal/platforms/telegram"
"github.com/pagu-project/Pagu/pkg/log"
pagucmd "github.com/pagu-project/pagu/cmd"
"github.com/pagu-project/pagu/config"
"github.com/pagu-project/pagu/internal/engine"
"github.com/pagu-project/pagu/internal/platforms/telegram"
"github.com/pagu-project/pagu/pkg/log"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"

"github.com/pactus-project/pactus/util"
"github.com/pagu-project/Pagu/pkg/amount"
"github.com/pagu-project/pagu/pkg/amount"
"gopkg.in/yaml.v3"
)

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/pagu-project/Pagu
module github.com/pagu-project/pagu

go 1.23.3

Expand All @@ -13,6 +13,7 @@ require (
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.10.0
go.uber.org/mock v0.5.0
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67
golang.org/x/text v0.21.0
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.36.1
Expand Down Expand Up @@ -57,7 +58,6 @@ require (
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241223144023-3abc09e42ca8 // indirect
Expand Down
4 changes: 2 additions & 2 deletions internal/delivery/grpc/pagu.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package grpc
import (
"context"

pagu "github.com/pagu-project/Pagu/internal/delivery/grpc/gen/go"
"github.com/pagu-project/Pagu/internal/entity"
pagu "github.com/pagu-project/pagu/internal/delivery/grpc/gen/go"
"github.com/pagu-project/pagu/internal/entity"
)

type paguServer struct {
Expand Down
8 changes: 4 additions & 4 deletions internal/delivery/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"net"

"github.com/pagu-project/Pagu/config"
pagu "github.com/pagu-project/Pagu/internal/delivery/grpc/gen/go"
"github.com/pagu-project/Pagu/internal/engine"
"github.com/pagu-project/Pagu/pkg/log"
"github.com/pagu-project/pagu/config"
pagu "github.com/pagu-project/pagu/internal/delivery/grpc/gen/go"
"github.com/pagu-project/pagu/internal/engine"
"github.com/pagu-project/pagu/pkg/log"
"google.golang.org/grpc"
)

Expand Down
8 changes: 4 additions & 4 deletions internal/delivery/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"net/http"

"github.com/labstack/echo/v4"
"github.com/pagu-project/Pagu/config"
"github.com/pagu-project/Pagu/internal/engine"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/pkg/log"
"github.com/pagu-project/pagu/config"
"github.com/pagu-project/pagu/internal/engine"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/pkg/log"
)

type HTTPServer struct {
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/calculator/calculator.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package calculator

import (
"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/pkg/client"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/pkg/client"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/calculator/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package calculator
import (
"errors"

"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/pkg/amount"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/pkg/amount"
)

func (bc *Calculator) calcFeeHandler(
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/calculator/reward.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"strconv"

"github.com/pactus-project/pactus/types/amount"
"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/pkg/utils"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/pkg/utils"
)

func (bc *Calculator) calcRewardHandler(
Expand Down
4 changes: 2 additions & 2 deletions internal/engine/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"slices"

"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/pkg/color"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/pkg/color"
)

var (
Expand Down
8 changes: 4 additions & 4 deletions internal/engine/command/market/market.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package market

import (
"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/pkg/cache"
"github.com/pagu-project/Pagu/pkg/client"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/pkg/cache"
"github.com/pagu-project/pagu/pkg/client"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/market/price.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"strconv"
"strings"

"github.com/pagu-project/Pagu/config"
"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/pagu/config"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
)

func (m *Market) getPrice(_ *entity.User, cmd *command.Command, _ map[string]string) command.CommandResult {
Expand Down
8 changes: 4 additions & 4 deletions internal/engine/command/market/price_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"testing"
"time"

"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/internal/job"
"github.com/pagu-project/Pagu/pkg/cache"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/internal/job"
"github.com/pagu-project/pagu/pkg/cache"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/middleware.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package command

import (
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/internal/repository"
"github.com/pagu-project/Pagu/pkg/wallet"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/internal/repository"
"github.com/pagu-project/pagu/pkg/wallet"
)

type MiddlewareFunc func(caller *entity.User, cmd *Command, args map[string]string) error
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/network/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package network
import (
"time"

"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
utils2 "github.com/pagu-project/Pagu/pkg/utils"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
utils2 "github.com/pagu-project/pagu/pkg/utils"
)

func (n *Network) networkHealthHandler(
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package network
import (
"context"

"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/Pagu/pkg/client"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
"github.com/pagu-project/pagu/pkg/client"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/network/node_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"

"github.com/pactus-project/pactus/types/amount"
"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
utils2 "github.com/pagu-project/Pagu/pkg/utils"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
utils2 "github.com/pagu-project/pagu/pkg/utils"
)

func (n *Network) nodeInfoHandler(_ *entity.User, cmd *command.Command, args map[string]string) command.CommandResult {
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/command/network/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package network

import (
"github.com/pactus-project/pactus/types/amount"
"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
utils2 "github.com/pagu-project/Pagu/pkg/utils"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
utils2 "github.com/pagu-project/pagu/pkg/utils"
)

func (n *Network) networkStatusHandler(
Expand Down
4 changes: 2 additions & 2 deletions internal/engine/command/phoenix/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package phoenix
import (
"errors"

"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/entity"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/entity"
)

func (pt *Phoenix) faucetHandler(
Expand Down
8 changes: 4 additions & 4 deletions internal/engine/command/phoenix/network_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package phoenix

import (
"github.com/pactus-project/pactus/types/amount"
"github.com/pagu-project/Pagu/internal/engine/command"
"github.com/pagu-project/Pagu/internal/engine/command/network"
"github.com/pagu-project/Pagu/internal/entity"
utils2 "github.com/pagu-project/Pagu/pkg/utils"
"github.com/pagu-project/pagu/internal/engine/command"
"github.com/pagu-project/pagu/internal/engine/command/network"
"github.com/pagu-project/pagu/internal/entity"
utils2 "github.com/pagu-project/pagu/pkg/utils"
)

func (pt *Phoenix) networkStatusHandler(
Expand Down
Loading

0 comments on commit c046fcb

Please sign in to comment.