Browse Source

Merge pull request #336 from dtm-labs/alpha

dapr supported
alpha
yedf2 4 years ago
committed by GitHub
parent
commit
ae65d3083f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .github/workflows/tests.yml
  2. 2
      client/dtmcli/barrier.go
  3. 2
      client/dtmcli/barrier_mongo.go
  4. 2
      client/dtmcli/barrier_redis.go
  5. 2
      client/dtmcli/dtmimp/utils.go
  6. 5
      client/dtmcli/dtmimp/vars.go
  7. 135
      client/dtmcli/logger/log.go
  8. 31
      client/dtmcli/logger/logger.go
  9. 46
      client/dtmcli/logger/logger_test.go
  10. 2
      client/dtmgrpc/dtmgimp/grpc_clients.go
  11. 2
      client/dtmgrpc/dtmgimp/types.go
  12. 2
      client/dtmgrpc/dtmgimp/utils.go
  13. 2
      client/workflow/factory.go
  14. 2
      client/workflow/imp.go
  15. 2
      client/workflow/workflow.go
  16. 2
      dtmsvr/api.go
  17. 2
      dtmsvr/api_json_rpc.go
  18. 2
      dtmsvr/config/config.go
  19. 2
      dtmsvr/cron.go
  20. 2
      dtmsvr/entry/main.go
  21. 1
      dtmsvr/microservices/drivers.go
  22. 2
      dtmsvr/storage/boltdb/boltdb.go
  23. 2
      dtmsvr/storage/redis/redis.go
  24. 2
      dtmsvr/storage/registry/registry.go
  25. 2
      dtmsvr/svr.go
  26. 2
      dtmsvr/trans_class.go
  27. 2
      dtmsvr/trans_process.go
  28. 2
      dtmsvr/trans_status.go
  29. 2
      dtmsvr/trans_type_msg.go
  30. 2
      dtmsvr/trans_type_saga.go
  31. 2
      dtmsvr/trans_type_tcc.go
  32. 2
      dtmutil/db.go
  33. 2
      dtmutil/utils.go
  34. 7
      go.mod
  35. 1630
      go.sum
  36. 2
      helper/bench/main.go
  37. 4
      helper/bench/svr/http.go
  38. 2
      helper/test-cover.sh
  39. 2
      main.go
  40. 2
      test/base_test.go
  41. 2
      test/busi/base_grpc.go
  42. 2
      test/busi/base_http.go
  43. 2
      test/busi/base_jrpc.go
  44. 2
      test/busi/base_types.go
  45. 2
      test/busi/data.go
  46. 2
      test/busi/utils.go
  47. 2
      test/main_test.go
  48. 2
      test/msg_barrier_test.go
  49. 2
      test/msg_grpc_barrier_test.go
  50. 2
      test/tcc_barrier_test.go
  51. 2
      test/tcc_grpc_test.go
  52. 2
      test/types.go
  53. 2
      test/workflow_http_test.go
  54. 2
      test/workflow_ongoing_test.go
  55. 2
      test/workflow_xa_test.go

4
.github/workflows/tests.yml

@ -46,10 +46,10 @@ jobs:
ports:
- 27017:27017
steps:
- name: Set up Go 1.16
- name: Set up Go 1.18
uses: actions/setup-go@v2
with:
go-version: '1.16'
go-version: '1.18'
- name: Check out code
uses: actions/checkout@v2

2
client/dtmcli/barrier.go

@ -12,7 +12,7 @@ import (
"net/url"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
)
// BarrierBusiFunc type for busi func

2
client/dtmcli/barrier_mongo.go

@ -5,7 +5,7 @@ import (
"strings"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
)

2
client/dtmcli/barrier_redis.go

@ -4,7 +4,7 @@ import (
"fmt"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
"github.com/go-redis/redis/v8"
)

2
client/dtmcli/dtmimp/utils.go

@ -19,7 +19,7 @@ import (
"sync"
"time"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
"github.com/go-resty/resty/v2"
)

5
client/dtmcli/dtmimp/vars.go

@ -9,8 +9,8 @@ package dtmimp
import (
"errors"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtmdriver"
"github.com/dtm-labs/logger"
"github.com/go-resty/resty/v2"
)
@ -42,13 +42,14 @@ var BarrierTableName = "dtm_barrier.barrier"
// AddRestyMiddlewares will add the middlewares used by dtm
func AddRestyMiddlewares(client *resty.Client) {
client.OnBeforeRequest(func(c *resty.Client, r *resty.Request) error {
logger.Debugf("requesting: %s %s %s resolved: %s", r.Method, r.URL, MustMarshalString(r.Body), r.URL)
old := r.URL
r.URL = MayReplaceLocalhost(r.URL)
ms := dtmdriver.Middlewares.HTTP
var err error
for i := 0; i < len(ms) && err == nil; i++ {
err = ms[i](c, r)
}
logger.Debugf("requesting: %s %s %s resolved: %s err: %v", r.Method, old, MustMarshalString(r.Body), r.URL, err)
return err
})
client.OnAfterResponse(func(c *resty.Client, resp *resty.Response) error {

135
client/dtmcli/logger/log.go

@ -1,135 +0,0 @@
package logger
import (
"encoding/json"
"fmt"
"log"
"net/url"
"os"
"runtime/debug"
"strings"
"github.com/natefinch/lumberjack"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
//var logger *zap.SugaredLogger = nil
var logger Logger
const (
// StdErr is the default configuration for log output.
StdErr = "stderr"
// StdOut configuration for log output
StdOut = "stdout"
)
func init() {
InitLog(os.Getenv("LOG_LEVEL"))
}
// Logger logger interface
type Logger interface {
Debugf(format string, args ...interface{})
Infof(format string, args ...interface{})
Warnf(format string, args ...interface{})
Errorf(format string, args ...interface{})
}
// WithLogger replaces default logger
func WithLogger(log Logger) {
logger = log
}
// InitLog is an initialization for a logger
// level can be: debug info warn error
func InitLog(level string) {
InitLog2(level, StdOut, 0, "")
}
// InitLog2 specify advanced log config
func InitLog2(level string, outputs string, logRotationEnable int64, logRotateConfigJSON string) {
outputPaths := strings.Split(outputs, ",")
for i, v := range outputPaths {
if logRotationEnable != 0 && v != StdErr && v != StdOut {
outputPaths[i] = fmt.Sprintf("lumberjack://%s", v)
}
}
if logRotationEnable != 0 {
setupLogRotation(logRotateConfigJSON)
}
config := loadConfig(level)
config.OutputPaths = outputPaths
p, err := config.Build(zap.AddCallerSkip(1))
FatalIfError(err)
logger = p.Sugar()
}
type lumberjackSink struct {
lumberjack.Logger
}
func (*lumberjackSink) Sync() error {
return nil
}
// setupLogRotation initializes log rotation for a single file path target.
func setupLogRotation(logRotateConfigJSON string) {
err := zap.RegisterSink("lumberjack", func(u *url.URL) (zap.Sink, error) {
var conf lumberjackSink
err := json.Unmarshal([]byte(logRotateConfigJSON), &conf)
FatalfIf(err != nil, "bad config LogRotateConfigJSON: %v", err)
conf.Filename = u.Host + u.Path
return &conf, nil
})
FatalIfError(err)
}
func loadConfig(logLevel string) zap.Config {
config := zap.NewProductionConfig()
err := config.Level.UnmarshalText([]byte(logLevel))
FatalIfError(err)
config.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
if os.Getenv("DTM_DEBUG") != "" {
config.Encoding = "console"
config.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
}
return config
}
// Debugf log to level debug
func Debugf(fmt string, args ...interface{}) {
logger.Debugf(fmt, args...)
}
// Infof log to level info
func Infof(fmt string, args ...interface{}) {
logger.Infof(fmt, args...)
}
// Warnf log to level warn
func Warnf(fmt string, args ...interface{}) {
logger.Warnf(fmt, args...)
}
// Errorf log to level error
func Errorf(fmt string, args ...interface{}) {
logger.Errorf(fmt, args...)
}
// FatalfIf log to level error
func FatalfIf(cond bool, fmt string, args ...interface{}) {
if !cond {
return
}
debug.PrintStack()
log.Fatalf(fmt, args...)
}
// FatalIfError if err is not nil, then log to level fatal and call os.Exit
func FatalIfError(err error) {
FatalfIf(err != nil, "fatal error: %v", err)
}

31
client/dtmcli/logger/logger.go

@ -0,0 +1,31 @@
package logger
import (
"github.com/dtm-labs/logger"
)
var (
// WithLogger replaces default logger
WithLogger = logger.WithLogger
// InitLog is an initialization for a logger
// level can be: debug info warn error
InitLog = logger.InitLog
// InitLog2 specify advanced log config
InitLog2 = logger.InitLog2
// Debugf log to level debug
Debugf = logger.Debugf
// Infof log to level info
Infof = logger.Infof
// Warnf log to level warn
Warnf = logger.Warnf
// Errorf log to level error
Errorf = logger.Errorf
// FatalfIf log to level error
FatalfIf = logger.FatalfIf
// FatalIfError if err is not nil, then log to level fatal and call os.Exit
FatalIfError = logger.FatalIfError
)

46
client/dtmcli/logger/logger_test.go

@ -1,46 +0,0 @@
package logger
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
)
func TestInitLog(t *testing.T) {
os.Setenv("DTM_DEBUG", "1")
InitLog("debug")
Debugf("a debug msg")
Infof("a info msg")
Warnf("a warn msg")
Errorf("a error msg")
FatalfIf(false, "nothing")
FatalIfError(nil)
InitLog2("debug", "test.log,stderr", 0, "")
Debugf("a debug msg to console and file")
InitLog2("debug", "test2.log,/tmp/dtm-test1.log,/tmp/dtm-test.log,stdout,stderr", 1,
"{\"maxsize\": 1, \"maxage\": 1, \"maxbackups\": 1, \"compress\": false}")
Debugf("a debug msg to /tmp/dtm-test.log and test2.log and stdout and stderr")
// _ = os.Remove("test.log")
}
func TestWithLogger(t *testing.T) {
logger := zap.NewExample().Sugar()
WithLogger(logger)
Debugf("a debug msg")
Infof("a info msg")
Warnf("a warn msg")
Errorf("a error msg")
FatalfIf(false, "nothing")
FatalIfError(nil)
}
func TestCover(t *testing.T) {
sin := lumberjackSink{}
err := sin.Sync()
assert.Nil(t, err)
}

2
client/dtmgrpc/dtmgimp/grpc_clients.go

@ -11,9 +11,9 @@ import (
"sync"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgpb"
"github.com/dtm-labs/dtmdriver"
"github.com/dtm-labs/logger"
grpc "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

2
client/dtmgrpc/dtmgimp/types.go

@ -12,8 +12,8 @@ import (
"time"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtmdriver"
"github.com/dtm-labs/logger"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"

2
client/dtmgrpc/dtmgimp/utils.go

@ -10,8 +10,8 @@ import (
context "context"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgpb"
"github.com/dtm-labs/logger"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/proto"
emptypb "google.golang.org/protobuf/types/known/emptypb"

2
client/workflow/factory.go

@ -4,7 +4,7 @@ import (
"fmt"
"net/url"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
)
type workflowFactory struct {

2
client/workflow/imp.go

@ -7,7 +7,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
"github.com/go-resty/resty/v2"
)

2
client/workflow/workflow.go

@ -9,9 +9,9 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgimp"
"github.com/dtm-labs/dtm/client/workflow/wfpb"
"github.com/dtm-labs/logger"
"github.com/go-resty/resty/v2"
"google.golang.org/grpc"
)

2
dtmsvr/api.go

@ -12,8 +12,8 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr/storage"
"github.com/dtm-labs/logger"
)
// Version store the passin version for dtm server

2
dtmsvr/api_json_rpc.go

@ -8,7 +8,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
)

2
dtmsvr/config/config.go

@ -5,7 +5,7 @@ import (
"io/ioutil"
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
"gopkg.in/yaml.v3"
)

2
dtmsvr/cron.go

@ -15,7 +15,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
)
// NowForwardDuration will be set in test, trans may be timeout

2
dtmsvr/entry/main.go

@ -8,10 +8,10 @@ import (
"time"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr"
"github.com/dtm-labs/dtm/dtmsvr/config"
"github.com/dtm-labs/dtm/dtmsvr/storage/registry"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
"go.uber.org/automaxprocs/maxprocs"
)

1
dtmsvr/microservices/drivers.go

@ -2,6 +2,7 @@ package microservices
import (
// load the microserver drivers
_ "github.com/dtm-labs/dtmdriver-dapr"
_ "github.com/dtm-labs/dtmdriver-gozero"
_ "github.com/dtm-labs/dtmdriver-kratos"
_ "github.com/dtm-labs/dtmdriver-polaris"

2
dtmsvr/storage/boltdb/boltdb.go

@ -12,9 +12,9 @@ import (
"time"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr/storage"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/logger"
bolt "go.etcd.io/bbolt"
)

2
dtmsvr/storage/redis/redis.go

@ -16,10 +16,10 @@ import (
"github.com/go-redis/redis/v8"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr/config"
"github.com/dtm-labs/dtm/dtmsvr/storage"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/logger"
)
// TODO: optimize this, it's very strange to use pointer to dtmutil.Config

2
dtmsvr/storage/registry/registry.go

@ -3,7 +3,7 @@ package registry
import (
"time"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
"github.com/dtm-labs/dtm/dtmsvr/config"
"github.com/dtm-labs/dtm/dtmsvr/storage"

2
dtmsvr/svr.go

@ -16,11 +16,11 @@ import (
"github.com/gin-gonic/gin"
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgimp"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgpb"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/dtmdriver"
"github.com/dtm-labs/logger"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

2
dtmsvr/trans_class.go

@ -6,10 +6,10 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgimp"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgpb"
"github.com/dtm-labs/dtm/dtmsvr/storage"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
)

2
dtmsvr/trans_process.go

@ -13,8 +13,8 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/logger"
)
// Process process global transaction once

2
dtmsvr/trans_status.go

@ -9,11 +9,11 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgimp"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/dtmdriver"
"github.com/dtm-labs/logger"
"github.com/lithammer/shortuuid/v3"
"google.golang.org/grpc/metadata"
)

2
dtmsvr/trans_type_msg.go

@ -6,7 +6,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
)
type transMsgProcessor struct {

2
dtmsvr/trans_type_saga.go

@ -7,7 +7,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
)
type transSagaProcessor struct {

2
dtmsvr/trans_type_tcc.go

@ -5,7 +5,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
)
type transTccProcessor struct {

2
dtmutil/db.go

@ -8,7 +8,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
_ "github.com/go-sql-driver/mysql" // register mysql driver
_ "github.com/lib/pq" // register postgres driver
"gorm.io/driver/mysql"

2
dtmutil/utils.go

@ -22,7 +22,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
)
// GetGinApp init and return gin

7
go.mod

@ -4,21 +4,19 @@ go 1.16
require (
bou.ke/monkey v1.0.2
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/dtm-labs/dtmdriver v0.0.6
github.com/dtm-labs/dtmdriver-dapr v0.0.1
github.com/dtm-labs/dtmdriver-gozero v0.0.7
github.com/dtm-labs/dtmdriver-kratos v0.0.9
github.com/dtm-labs/dtmdriver-polaris v0.0.5
github.com/dtm-labs/dtmdriver-springcloud v1.2.3
github.com/dtm-labs/logger v0.0.1
github.com/gin-gonic/gin v1.7.7
github.com/go-playground/validator/v10 v10.11.0 // indirect
github.com/go-redis/redis/v8 v8.11.5
github.com/go-resty/resty/v2 v2.7.0
github.com/go-sql-driver/mysql v1.6.0
github.com/lib/pq v1.10.6
github.com/lithammer/shortuuid v2.0.3+incompatible
github.com/lithammer/shortuuid/v3 v3.0.7
github.com/natefinch/lumberjack v2.0.0+incompatible
github.com/onsi/gomega v1.18.1
github.com/prometheus/client_golang v1.12.2
github.com/stretchr/testify v1.8.0
@ -26,7 +24,6 @@ require (
go.etcd.io/bbolt v1.3.6
go.mongodb.org/mongo-driver v1.9.1
go.uber.org/automaxprocs v1.5.1
go.uber.org/zap v1.21.0
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.0

1630
go.sum

File diff suppressed because it is too large

2
helper/bench/main.go

@ -5,12 +5,12 @@ import (
"os"
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr"
"github.com/dtm-labs/dtm/dtmsvr/config"
"github.com/dtm-labs/dtm/dtmsvr/storage/registry"
"github.com/dtm-labs/dtm/helper/bench/svr"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
)
var usage = `bench is a bench test server for dtmf

4
helper/bench/svr/http.go

@ -17,12 +17,12 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
"github.com/lithammer/shortuuid"
"github.com/lithammer/shortuuid/v3"
)
// launch command:go run app/main.go qs

2
helper/test-cover.sh

@ -1,7 +1,7 @@
set -x
echo "mode: count" > coverage.txt
for store in redis boltdb mysql postgres; do
TEST_STORE=$store go test -failfast -covermode count -coverprofile=profile.out -coverpkg=github.com/dtm-labs/dtm/client/dtmcli,github.com/dtm-labs/dtm/client/dtmcli/dtmimp,github.com/dtm-labs/dtm/client/dtmcli/logger,github.com/dtm-labs/dtm/client/dtmgrpc,github.com/dtm-labs/dtm/client/workflow,github.com/dtm-labs/dtm/client/dtmgrpc/dtmgimp,github.com/dtm-labs/dtm/dtmsvr,dtmsvr/config,github.com/dtm-labs/dtm/dtmsvr/storage,github.com/dtm-labs/dtm/dtmsvr/storage/boltdb,github.com/dtm-labs/dtm/dtmsvr/storage/redis,github.com/dtm-labs/dtm/dtmsvr/storage/registry,github.com/dtm-labs/dtm/dtmsvr/storage/sql,github.com/dtm-labs/dtm/dtmutil -gcflags=-l ./... || exit 1
TEST_STORE=$store go test -failfast -covermode count -coverprofile=profile.out -coverpkg=github.com/dtm-labs/dtm/client/dtmcli,github.com/dtm-labs/dtm/client/dtmcli/dtmimp,github.com/dtm-labs/logger,github.com/dtm-labs/dtm/client/dtmgrpc,github.com/dtm-labs/dtm/client/workflow,github.com/dtm-labs/dtm/client/dtmgrpc/dtmgimp,github.com/dtm-labs/dtm/dtmsvr,dtmsvr/config,github.com/dtm-labs/dtm/dtmsvr/storage,github.com/dtm-labs/dtm/dtmsvr/storage/boltdb,github.com/dtm-labs/dtm/dtmsvr/storage/redis,github.com/dtm-labs/dtm/dtmsvr/storage/registry,github.com/dtm-labs/dtm/dtmsvr/storage/sql,github.com/dtm-labs/dtm/dtmutil -gcflags=-l ./... || exit 1
if [ -f profile.out ]; then
cat profile.out | grep -v 'mode:' >> coverage.txt
echo > profile.out

2
main.go

@ -19,10 +19,10 @@ import (
"strings"
"syscall"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr/config"
"github.com/dtm-labs/dtm/dtmsvr/entry"
_ "github.com/dtm-labs/dtm/dtmsvr/microservices"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
)

2
test/base_test.go

@ -13,9 +13,9 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/stretchr/testify/assert"
)

2
test/busi/base_grpc.go

@ -15,9 +15,9 @@ import (
"time"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgimp"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgpb"

2
test/busi/base_http.go

@ -14,9 +14,9 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/workflow"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
"gorm.io/driver/mysql"
"gorm.io/driver/postgres"

2
test/busi/base_jrpc.go

@ -4,8 +4,8 @@ import (
"fmt"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
)

2
test/busi/base_types.go

@ -12,7 +12,7 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
)

2
test/busi/data.go

@ -8,8 +8,8 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"

2
test/busi/utils.go

@ -11,10 +11,10 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgpb"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
"github.com/go-redis/redis/v8"
"github.com/go-resty/resty/v2"

2
test/main_test.go

@ -13,7 +13,6 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/workflow"
"github.com/dtm-labs/dtm/dtmsvr"
"github.com/dtm-labs/dtm/dtmsvr/config"
@ -21,6 +20,7 @@ import (
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/dtmdriver"
"github.com/dtm-labs/logger"
)
func TestMain(m *testing.M) {

2
test/msg_barrier_test.go

@ -9,8 +9,8 @@ import (
"bou.ke/monkey"
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/stretchr/testify/assert"
)

2
test/msg_grpc_barrier_test.go

@ -8,9 +8,9 @@ import (
"bou.ke/monkey"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/stretchr/testify/assert"
)

2
test/tcc_barrier_test.go

@ -14,8 +14,8 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/gin-gonic/gin"
"github.com/go-resty/resty/v2"
"github.com/stretchr/testify/assert"

2
test/tcc_grpc_test.go

@ -12,10 +12,10 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/types/known/emptypb"
)

2
test/types.go

@ -12,11 +12,11 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/dtmsvr"
"github.com/dtm-labs/dtm/dtmsvr/config"
"github.com/dtm-labs/dtm/dtmutil"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/stretchr/testify/assert"
)

2
test/workflow_http_test.go

@ -12,9 +12,9 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/workflow"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/stretchr/testify/assert"
)

2
test/workflow_ongoing_test.go

@ -12,10 +12,10 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/dtmgrpc/dtmgimp"
"github.com/dtm-labs/dtm/client/workflow"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/stretchr/testify/assert"
)

2
test/workflow_xa_test.go

@ -12,9 +12,9 @@ import (
"github.com/dtm-labs/dtm/client/dtmcli"
"github.com/dtm-labs/dtm/client/dtmcli/dtmimp"
"github.com/dtm-labs/dtm/client/dtmcli/logger"
"github.com/dtm-labs/dtm/client/workflow"
"github.com/dtm-labs/dtm/test/busi"
"github.com/dtm-labs/logger"
"github.com/stretchr/testify/assert"
)

Loading…
Cancel
Save