Skip to content

Commit 8ac76f0

Browse files
committed
chore: fix test cases and lint issues
1 parent 454e5c4 commit 8ac76f0

File tree

5 files changed

+6
-21
lines changed

5 files changed

+6
-21
lines changed

regulation-worker/cmd/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func createHTTPClient(conf *config.Config, httpTimeout time.Duration) *http.Clie
152152
}
153153
return oauthv2http.NewOAuthHttpClient(
154154
cli,
155-
common.RudderFlow(common.RudderFlowDelete),
155+
common.RudderFlowDelete,
156156
&cache, backendconfig.DefaultBackendConfig,
157157
api.GetAuthErrorCategoryFromResponse, &optionalArgs,
158158
)

regulation-worker/internal/delete/api/api.go

-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ type APIManager struct {
4040
TransformerFeaturesService transformer.FeaturesService
4141
}
4242

43-
type oauthDetail struct {
44-
id string
45-
}
46-
4743
func GetAuthErrorCategoryFromResponse(bodyBytes []byte) (string, error) {
4844
var jobResp []JobRespSchema
4945
if err := jsonrs.Unmarshal(bodyBytes, &jobResp); err != nil {

regulation-worker/internal/delete/api/api_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ func TestOAuth(t *testing.T) {
829829
Locker: oauthLock,
830830
}
831831
cli = oauthv2_http.NewOAuthHttpClient(
832-
cli, common.RudderFlow(common.RudderFlowDelete),
832+
cli, common.RudderFlowDelete,
833833
&cache, mockBackendConfig,
834834
api.GetAuthErrorCategoryFromResponse, &optionalArgs,
835835
)
@@ -843,8 +843,7 @@ func TestOAuth(t *testing.T) {
843843
status := api.Delete(ctx, tt.job, tt.dest)
844844
require.Equal(t, tt.expectedDeleteStatus.Status, status.Status)
845845
if tt.expectedDeleteStatus.Status != model.JobStatusComplete {
846-
exp := tt.expectedDeleteStatus.Error.Error()
847-
exp = tt.expectedDeleteStatus_OAuthV2.Error.Error()
846+
exp := tt.expectedDeleteStatus_OAuthV2.Error.Error()
848847
jobError := strings.Replace(exp, "__cfgBE_server__", cfgBeSrv.URL, 1)
849848

850849
require.Contains(t, strings.ToLower(status.Error.Error()), strings.ToLower(jobError))

router/transformer/transformer.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,9 @@ func (trans *handle) ProxyRequest(ctx context.Context, proxyReqParams *ProxyRequ
522522
transResp.routerJobResponseBodys[metadata.JobID] = transportResponse.InterceptorResponse.Response
523523
}
524524
}
525-
respData = []byte(transportResponse.InterceptorResponse.Response)
525+
if transportResponse.InterceptorResponse.Response != "" {
526+
respData = []byte(transportResponse.InterceptorResponse.Response)
527+
}
526528

527529
trans.stats.NewTaggedStat("transformer_client_response_total_events", stats.CountType, labels).Count(len(transResp.routerJobResponseCodes))
528530

router/types.go

-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package router
22

33
import (
4-
"context"
54
"encoding/json"
65
"sync"
76
"time"
@@ -22,17 +21,6 @@ type workerJobStatus struct {
2221
statTags map[string]string
2322
parameters routerutils.JobParameters
2423
}
25-
26-
type HandleDestOAuthRespParams struct {
27-
ctx context.Context
28-
destinationJob types.DestinationJobT
29-
workerID int
30-
trRespStCd int
31-
trRespBody string
32-
secret json.RawMessage
33-
contentType string
34-
}
35-
3624
type Diagnostic struct {
3725
diagnosisTicker *time.Ticker
3826
requestsMetricLock sync.RWMutex

0 commit comments

Comments
 (0)