Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Maintaining audit logs #3763

Merged
merged 38 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7208a86
Middleware
dhananjay0601 Aug 10, 2023
7b9ef87
logger middleware service layer
dhananjay0601 Aug 10, 2023
394cd30
updated files
dhananjay0601 Aug 10, 2023
a3780fd
updated files
dhananjay0601 Aug 10, 2023
f618c2b
Merge branch 'main' into maintaining_audit_logs
dhananjay0601 Aug 16, 2023
3f86b00
updated files
dhananjay0601 Aug 16, 2023
6c30b20
commented code
dhananjay0601 Aug 16, 2023
9e2bf7e
updated files
dhananjay0601 Aug 16, 2023
5ed5b44
updated files
dhananjay0601 Aug 16, 2023
b9ee3f0
updated files
dhananjay0601 Aug 16, 2023
02baca9
pr comments
dhananjay0601 Aug 17, 2023
9790c15
updated files
dhananjay0601 Aug 17, 2023
43bd5be
Merge branch 'main' into maintaining_audit_logs
dhananjay0601 Aug 17, 2023
9573c5b
updated files
dhananjay0601 Aug 17, 2023
38ebea6
updated files
dhananjay0601 Aug 17, 2023
f002a8a
Merge branch 'main' into maintaining_audit_logs
prakash100198 Aug 21, 2023
b056a07
refactoring
prakash100198 Aug 21, 2023
2fc08ed
Merge branch 'main' into maintaining_audit_logs
dhananjay0601 Aug 21, 2023
a66126f
removing spilled userAuth object
prakash100198 Aug 21, 2023
4c9a92b
refactoring
prakash100198 Aug 21, 2023
d6f867d
updated files
dhananjay0601 Aug 21, 2023
253a480
refactoring functions names
prakash100198 Aug 21, 2023
5086f59
wire gen
prakash100198 Aug 21, 2023
f74a95d
Merge branch 'main' of https://github.com/devtron-labs/devtron into m…
dhananjay0601 Aug 22, 2023
12dbf6e
updated files
dhananjay0601 Aug 22, 2023
ef8de76
making middleware more efficient
prakash100198 Aug 23, 2023
3ed292f
Merge branch 'main' into maintaining_audit_logs
prakash100198 Aug 23, 2023
03e065f
adding status code in audit log middleware
prakash100198 Aug 23, 2023
78f3459
log fix
prakash100198 Aug 23, 2023
8317683
refactoring
prakash100198 Aug 24, 2023
ca78520
refactoring and few fixes
prakash100198 Aug 24, 2023
24907e5
changed package + refactoring
prakash100198 Aug 24, 2023
879acc0
argocd assets added
prakash100198 Aug 24, 2023
44ed17d
removed unnecessary code
prakash100198 Aug 25, 2023
7d5fe5b
Merge branch 'main' into maintaining_audit_logs
prakash100198 Aug 28, 2023
c7473c2
EOF error fix
prakash100198 Aug 29, 2023
27ad4e0
Merge branch 'main' into maintaining_audit_logs
prakash100198 Aug 29, 2023
b3a910e
request payload place changed to be printed at last
prakash100198 Aug 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion App.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"context"
"crypto/tls"
"fmt"
"github.com/devtron-labs/devtron/api/logger"
"github.com/devtron-labs/devtron/client/telemetry"
"github.com/devtron-labs/devtron/otel"
"log"
Expand Down Expand Up @@ -54,6 +55,7 @@ type App struct {
serveTls bool
sessionManager2 *authMiddleware.SessionManager
OtelTracingService *otel.OtelTracingServiceImpl
loggingMiddleware logger.LoggingMiddleware
}

func NewApp(router *router.MuxRouter,
Expand All @@ -64,6 +66,7 @@ func NewApp(router *router.MuxRouter,
pubsubClient *pubsub.PubSubClientServiceImpl,
sessionManager2 *authMiddleware.SessionManager,
posthogClient *telemetry.PosthogClient,
loggingMiddleware logger.LoggingMiddleware,
) *App {
//check argo connection
//todo - check argo-cd version on acd integration installation
Expand All @@ -78,6 +81,7 @@ func NewApp(router *router.MuxRouter,
sessionManager2: sessionManager2,
posthogClient: posthogClient,
OtelTracingService: otel.NewOtelTracingServiceImpl(Logger),
loggingMiddleware: loggingMiddleware,
}
return app
}
Expand All @@ -94,7 +98,7 @@ func (app *App) Start() {
//authEnforcer := casbin2.Create()

server := &http.Server{Addr: fmt.Sprintf(":%d", port), Handler: authMiddleware.Authorizer(app.sessionManager2, user.WhitelistChecker)(app.MuxRouter.Router)}

app.MuxRouter.Router.Use(app.loggingMiddleware.LoggingMiddleware)
app.MuxRouter.Router.Use(middleware.PrometheusMiddleware)
if tracerProvider != nil {
app.MuxRouter.Router.Use(otelmux.Middleware(otel.OTEL_ORCHESTRASTOR_SERVICE_NAME))
Expand Down
3 changes: 3 additions & 0 deletions Wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/devtron-labs/devtron/api/externalLink"
client "github.com/devtron-labs/devtron/api/helm-app"
"github.com/devtron-labs/devtron/api/k8s"
"github.com/devtron-labs/devtron/api/logger"
"github.com/devtron-labs/devtron/api/module"
"github.com/devtron-labs/devtron/api/restHandler"
pipeline2 "github.com/devtron-labs/devtron/api/restHandler/app"
Expand Down Expand Up @@ -213,6 +214,8 @@ func InitializeApp() (*App, error) {
pipeline.GetDeploymentServiceTypeConfig,
pipeline.NewPipelineBuilderImpl,
wire.Bind(new(pipeline.PipelineBuilder), new(*pipeline.PipelineBuilderImpl)),
logger.NewLoggingMiddlewareImpl,
wire.Bind(new(logger.LoggingMiddleware), new(*logger.LoggingMiddlewareImpl)),
pipeline2.NewPipelineRestHandlerImpl,
wire.Bind(new(pipeline2.PipelineConfigRestHandler), new(*pipeline2.PipelineConfigRestHandlerImpl)),
router.NewPipelineRouterImpl,
Expand Down
1 change: 0 additions & 1 deletion api/appStore/deployment/AppStoreDeploymentRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func NewAppStoreDeploymentRouterImpl(appStoreDeploymentRestHandler AppStoreDeplo
}

func (router AppStoreDeploymentRouterImpl) Init(configRouter *mux.Router) {

configRouter.Path("/application/install").
HandlerFunc(router.appStoreDeploymentRestHandler.InstallApp).Methods("POST")

Expand Down
4 changes: 3 additions & 1 deletion api/dashboardEvent/DashboardTelemetryRouter.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package dashboardEvent

import "github.com/gorilla/mux"
import (
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
"github.com/gorilla/mux"
)

type DashboardTelemetryRouter interface {
Init(configRouter *mux.Router)
Expand Down
4 changes: 3 additions & 1 deletion api/deployment/DeploymentConfigRouter.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package deployment

import "github.com/gorilla/mux"
import (
"github.com/gorilla/mux"
)

type DeploymentConfigRouter interface {
Init(configRouter *mux.Router)
Expand Down
4 changes: 3 additions & 1 deletion api/helm-app/HelmAppRouter.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package client

import "github.com/gorilla/mux"
import (
"github.com/gorilla/mux"
)

type HelmAppRouter interface {
InitAppListRouter(helmRouter *mux.Router)
Expand Down
1 change: 0 additions & 1 deletion api/k8s/application/k8sApplicationRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func NewK8sApplicationRouterImpl(k8sApplicationRestHandler K8sApplicationRestHan
}

func (impl *K8sApplicationRouterImpl) InitK8sApplicationRouter(k8sAppRouter *mux.Router) {

k8sAppRouter.Path("/resource/rotate").Queries("appId", "{appId}").
HandlerFunc(impl.k8sApplicationRestHandler.RotatePod).Methods("POST")

Expand Down
1 change: 0 additions & 1 deletion api/k8s/capacity/k8sCapacityRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ func NewK8sCapacityRouterImpl(k8sCapacityRestHandler K8sCapacityRestHandler) *K8
}

func (impl *K8sCapacityRouterImpl) InitK8sCapacityRouter(k8sCapacityRouter *mux.Router) {

k8sCapacityRouter.Path("/cluster/list/raw").
HandlerFunc(impl.k8sCapacityRestHandler.GetClusterListRaw).Methods("GET")

Expand Down
12 changes: 12 additions & 0 deletions api/logger/bean.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package logger

import "time"

type AuditLoggerDTO struct {
UrlPath string `json:"urlPath"`
UserEmail string `json:"userEmail"`
UpdatedOn time.Time `json:"updatedOn"`
QueryParams string `json:"queryParams"`
ApiResponseCode int `json:"apiResponseCode"`
RequestPayload []byte `json:"requestPayload"`
}
49 changes: 49 additions & 0 deletions api/logger/logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package logger

import (
"github.com/devtron-labs/devtron/pkg/user"
"io/ioutil"
"log"
"net/http"
"time"
)

type LoggingMiddlewareImpl struct {
userService user.UserService
}

func NewLoggingMiddlewareImpl(userService user.UserService) *LoggingMiddlewareImpl {
return &LoggingMiddlewareImpl{
userService: userService,
}
}

type LoggingMiddleware interface {
LoggingMiddleware(next http.Handler) http.Handler
}

// LoggingMiddleware is a middleware function that logs the incoming request.
func (impl LoggingMiddlewareImpl) LoggingMiddleware(next http.Handler) http.Handler {
prakash100198 marked this conversation as resolved.
Show resolved Hide resolved
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Call the next handler in the chain.
next.ServeHTTP(w, r)

token := r.Header.Get("token")
userEmail, err := impl.userService.GetEmailFromToken(token)
if err != nil {
log.Printf("user does not exists")
}
body, err := ioutil.ReadAll(r.Body)
if err != nil {
log.Printf("error reading request body for ", "urlPath: ", r.URL.Path, " queryParams: ", r.URL.Query().Encode(), " userEmail: ", userEmail)
}
auditLogDto := &AuditLoggerDTO{
UrlPath: r.URL.Path,
UserEmail: userEmail,
UpdatedOn: time.Now(),
QueryParams: r.URL.Query().Encode(),
RequestPayload: body,
}
LogRequest(auditLogDto)
})
}
9 changes: 9 additions & 0 deletions api/logger/loggerService.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package logger

import (
"log"
)

func LogRequest(auditLogDto *AuditLoggerDTO) {
log.Printf("urlPath: %s, queryParams: %s, requestPayload: %s,updatedBy: %s, updatedOn: %s, apiResponseCode: %d", auditLogDto.UrlPath, auditLogDto.QueryParams, auditLogDto.RequestPayload, auditLogDto.UserEmail, auditLogDto.UpdatedOn, auditLogDto.ApiResponseCode)
}
1 change: 0 additions & 1 deletion api/router/ApplicationRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func NewApplicationRouterImpl(handler restHandler.ArgoApplicationRestHandler, lo
}

func (r ApplicationRouterImpl) initApplicationRouter(router *mux.Router) {

router.Path("/stream").
Queries("name", "{name}").
Methods("GET").
Expand Down
1 change: 0 additions & 1 deletion api/router/CommonRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func NewCommonRouterImpl(commonRestHandler restHandler.CommonRestHanlder) *Commo
return &CommonRouterImpl{commonRestHandler: commonRestHandler}
}
func (impl CommonRouterImpl) InitCommonRouter(router *mux.Router) {

router.Path("/checklist").
HandlerFunc(impl.commonRestHandler.GlobalChecklist).
Methods("GET")
Expand Down
1 change: 0 additions & 1 deletion api/router/ConfigMapRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func NewConfigMapRouterImpl(restHandler restHandler.ConfigMapRestHandler) *Confi
}

func (router ConfigMapRouterImpl) initConfigMapRouter(configRouter *mux.Router) {

configRouter.Path("/global/cm").
HandlerFunc(router.restHandler.CMGlobalAddUpdate).Methods("POST")
configRouter.Path("/environment/cm").
Expand Down
1 change: 0 additions & 1 deletion api/router/MigrateDbRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func NewMigrateDbRouterImpl(migrateDbRestHandler restHandler.MigrateDbRestHandle
return &MigrateDbRouterImpl{migrateDbRestHandler: migrateDbRestHandler}
}
func (impl MigrateDbRouterImpl) InitMigrateDbRouter(migrateRouter *mux.Router) {

migrateRouter.Path("/db").
HandlerFunc(impl.migrateDbRestHandler.SaveDbConfig).
Methods("POST")
Expand Down
8 changes: 3 additions & 5 deletions api/router/PProfRouter.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package router

import (
"github.com/devtron-labs/devtron/api/restHandler"
"github.com/gorilla/mux"
"go.uber.org/zap"
"github.com/devtron-labs/devtron/api/restHandler"
"github.com/gorilla/mux"
"go.uber.org/zap"
)

type PProfRouter interface {
Expand All @@ -24,7 +24,6 @@ func NewPProfRouter(logger *zap.SugaredLogger,
}

func (ppr PProfRouterImpl) initPProfRouter(router *mux.Router) {

router.HandleFunc("/", ppr.pprofRestHandler.Index)
router.HandleFunc("/cmdline", ppr.pprofRestHandler.Cmdline)
router.HandleFunc("/profile", ppr.pprofRestHandler.Profile)
Expand All @@ -37,4 +36,3 @@ func (ppr PProfRouterImpl) initPProfRouter(router *mux.Router) {
router.HandleFunc("/mutex", ppr.pprofRestHandler.Mutex)
router.HandleFunc("/allocs", ppr.pprofRestHandler.Allocs)
}

1 change: 0 additions & 1 deletion api/router/PipelineConfigRouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func NewPipelineRouterImpl(restHandler app.PipelineConfigRestHandler,
pipelineHistoryRestHandler: pipelineHistoryRestHandler,
pipelineStatusTimelineRestHandler: pipelineStatusTimelineRestHandler,
}

}

func (router PipelineConfigRouterImpl) initPipelineConfigRouter(configRouter *mux.Router) {
Expand Down
1 change: 0 additions & 1 deletion api/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ func NewMuxRouter(logger *zap.SugaredLogger, HelmRouter PipelineTriggerRouter, P
}

func (r MuxRouter) Init() {

r.Router.PathPrefix("/orchestrator/api/vi/pod/exec/ws").Handler(terminal.CreateAttachHandler("/orchestrator/api/vi/pod/exec/ws"))

r.Router.StrictSlash(true)
Expand Down
1 change: 0 additions & 1 deletion cmd/external-app/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ func (r *MuxRouter) Init() {
}
_, _ = writer.Write(b)
})

ssoLoginRouter := baseRouter.PathPrefix("/sso").Subrouter()
r.ssoLoginRouter.InitSsoLoginRouter(ssoLoginRouter)
teamRouter := baseRouter.PathPrefix("/team").Subrouter()
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ require (
github.com/go-resty/resty/v2 v2.7.0
github.com/gogo/protobuf v1.3.2
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.9
github.com/google/go-github v17.0.0+incompatible
github.com/google/uuid v1.3.0
github.com/google/wire v0.3.0
github.com/google/wire v0.5.0
github.com/gorilla/mux v1.8.0
github.com/gorilla/schema v1.1.0
github.com/gorilla/sessions v1.2.1
Expand Down Expand Up @@ -140,7 +141,6 @@ require (
github.com/go-xorm/xorm v0.7.9 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-github/v41 v41.0.0 // indirect
Expand Down Expand Up @@ -233,14 +233,12 @@ require (
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/exp v0.0.0-20220602145555-4a0574d9293f // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.101.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
13 changes: 2 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/euank/go-kmsg-parser v2.0.0+incompatible/go.mod h1:MhmAMZ8V4CYH4ybgdRwPr2TU5ThnS43puaKEMpja1uw=
github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
Expand Down Expand Up @@ -557,8 +556,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/wire v0.3.0 h1:imGQZGEVEHpje5056+K+cgdO72p0LQv2xIIFXNGUf60=
github.com/google/wire v0.3.0/go.mod h1:i1DMg/Lu8Sz5yYl25iOdmc5CT5qusaa+zmRWs16741s=
github.com/google/wire v0.5.0 h1:I7ELFeVBr3yfPIcc8+MWvrjk+3VjbcSzoXm3JVa+jD8=
github.com/google/wire v0.5.0/go.mod h1:ngWDr9Qvq3yZA10YrxfyGELY/AFWGVpy9c1LTRi1EoU=
github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs=
github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
Expand All @@ -568,7 +567,6 @@ github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0
github.com/googleapis/gax-go/v2 v2.6.0 h1:SXk3ABtQYDT/OH8jAyvEOQ58mgawq5C4o/4/89qN2ZU=
github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=
github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
Expand Down Expand Up @@ -793,13 +791,11 @@ github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-ieproxy v0.0.1 h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqfI=
github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E=
github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
Expand Down Expand Up @@ -1325,8 +1321,6 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1-0.20210830214625-1b1db11ec8f4/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180406214816-61147c48b25b/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -1439,7 +1433,6 @@ golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down Expand Up @@ -1624,8 +1617,6 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func TestAppStatusRepositoryImpl_DeleteWithAppId(t *testing.T) {
//delete data having app_id = 1
tx1, _ := db.Begin()
deleteAppId := 1
err = repo.DeleteWithAppId(tx1, deleteAppId)
//err = repo.DeleteWithAppId(tx1, deleteAppId)
assert.Nil(t, err)
err = tx1.Commit()
if err != nil {
Expand Down Expand Up @@ -273,7 +273,7 @@ func getTestdata() []appStatus.AppStatusContainer {
return testDataArray
}

//utilities
// utilities
func insertTestData(testData appStatus.AppStatusContainer) {
model := appStatus.AppStatusDto{}
query := "insert into" +
Expand Down