Skip to content

Commit

Permalink
Fix validation tests
Browse files Browse the repository at this point in the history
Signed-off-by: Puneet Punamiya [email protected]
  • Loading branch information
PuneetPunamiya committed Oct 12, 2022
1 parent 3d03bb9 commit 4d823e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions api/pkg/db/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ func TestCheckNotNull(t *testing.T) {

err := db.Create(&model.Catalog{Name: "tekton", Type: "", URL: "", Revision: "master"}).Error
assert.Error(t, err)
assert.Equal(t, "ERROR: null value in column \"type\" violates not-null constraint (SQLSTATE 23502)", err.Error())
assert.Equal(t, "ERROR: null value in column \"type\" of relation \"catalogs\" violates not-null constraint (SQLSTATE 23502)", err.Error())

err = db.Create(&model.Resource{Name: "tekton", Rating: 4}).Error
assert.Error(t, err)
assert.Equal(t, "ERROR: null value in column \"kind\" violates not-null constraint (SQLSTATE 23502)", err.Error())
assert.Equal(t, "ERROR: null value in column \"kind\" of relation \"resources\" violates not-null constraint (SQLSTATE 23502)", err.Error())

err = db.Create(&model.ResourceVersion{Version: "", Description: "task", URL: "", DisplayName: "Task", MinPipelinesVersion: ""}).Error
assert.Error(t, err)
assert.Equal(t, "ERROR: null value in column \"version\" violates not-null constraint (SQLSTATE 23502)", err.Error())
assert.Equal(t, "ERROR: null value in column \"version\" of relation \"resource_versions\" violates not-null constraint (SQLSTATE 23502)", err.Error())
}

// Checks the Unique constraint
Expand Down
1 change: 0 additions & 1 deletion api/pkg/user/service/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ func (s *UserService) RefreshAccessToken(res http.ResponseWriter, req *http.Requ
refreshToken := req.Header.Get("Authorization")
user, err := s.validateRefreshToken(userId, refreshToken)
if err != nil {
r.log.Error(err)
http.Error(res, err.Error(), http.StatusInternalServerError)
return
}
Expand Down
4 changes: 2 additions & 2 deletions test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ ui-unittest() {
install-postgres() {
info Installing postgres 🛢🛢🛢
apt-get update
apt-get install -y postgresql postgresql-contrib
pg_ctlcluster 11 main start
apt-get install -y postgresql
pg_ctlcluster 13 main start
}

set-pg-passwd() {
Expand Down

0 comments on commit 4d823e5

Please sign in to comment.