This is an automated email from the ASF dual-hosted git repository.

hez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new cc6726561 fix: Fix failing tests (#4840)
cc6726561 is described below

commit cc6726561c7737b6cfa9cefdf4611ea156cd7de8
Author: Camille Teruel <[email protected]>
AuthorDate: Sat Apr 1 19:41:56 2023 +0200

    fix: Fix failing tests (#4840)
    
    * fix: Fix failing tests
    
    Commit 4c07a8113 renamed json two JSON tags of 
server/services/remote/models/models.go:ScopeModel fields.
    This made the python_plugin_test.go tests fail.
    
    * fix: Fix TransformationModel based tables
    
    Apparently a gorm bug prevent to have two uint64 primary keys in MySQL.
    
    ---------
    
    Co-authored-by: Camille Teruel <[email protected]>
---
 backend/server/services/remote/models/models.go    | 2 +-
 backend/server/services/remote/plugin/scope_api.go | 4 ++--
 backend/test/integration/remote/helper.go          | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/backend/server/services/remote/models/models.go 
b/backend/server/services/remote/models/models.go
index de12dbd82..85571a3ea 100644
--- a/backend/server/services/remote/models/models.go
+++ b/backend/server/services/remote/models/models.go
@@ -69,8 +69,8 @@ type ScopeModel struct {
 }
 
 type TransformationModel struct {
-       ConnectionId uint64    `gorm:"primaryKey" json:"connectionId"`
        Id           uint64    `gorm:"primaryKey" json:"id"`
+       ConnectionId uint64    `json:"connectionId"`
        Name         string    `json:"name"`
        CreatedAt    time.Time `json:"createdAt"`
        UpdatedAt    time.Time `json:"updatedAt"`
diff --git a/backend/server/services/remote/plugin/scope_api.go 
b/backend/server/services/remote/plugin/scope_api.go
index 44ea12d6c..dada4db9b 100644
--- a/backend/server/services/remote/plugin/scope_api.go
+++ b/backend/server/services/remote/plugin/scope_api.go
@@ -174,7 +174,7 @@ func (pa *pluginAPI) ListScopes(input 
*plugin.ApiResourceInput) (*plugin.ApiReso
        }
        var ruleIds []uint64
        for _, scopeModel := range scopeMap {
-               if tid := 
uint64(scopeModel["transformation_rule_id"].(float64)); tid > 0 {
+               if tid := uint64(scopeModel["transformationRuleId"].(float64)); 
tid > 0 {
                        ruleIds = append(ruleIds, tid)
                }
        }
@@ -197,7 +197,7 @@ func (pa *pluginAPI) ListScopes(input 
*plugin.ApiResourceInput) (*plugin.ApiReso
        }
        var apiScopes []apiScopeResponse
        for _, scope := range scopeMap {
-               txRuleName, ok := 
names[uint64(scope["transformation_rule_id"].(float64))]
+               txRuleName, ok := 
names[uint64(scope["transformationRuleId"].(float64))]
                if ok {
                        scopeRes := apiScopeResponse{
                                Scope:                  scope,
diff --git a/backend/test/integration/remote/helper.go 
b/backend/test/integration/remote/helper.go
index 1fee42b89..98bd78c11 100644
--- a/backend/test/integration/remote/helper.go
+++ b/backend/test/integration/remote/helper.go
@@ -45,8 +45,8 @@ type (
        FakeProject struct {
                Id                   string `json:"id"`
                Name                 string `json:"name"`
-               ConnectionId         uint64 `json:"connection_id"`
-               TransformationRuleId uint64 `json:"transformation_rule_id"`
+               ConnectionId         uint64 `json:"connectionId"`
+               TransformationRuleId uint64 `json:"transformationRuleId"`
        }
        FakeTxRule struct {
                Id   uint64 `json:"id"`

Reply via email to