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 13, 2022
1 parent 3d03bb9 commit a113ce3
Show file tree
Hide file tree
Showing 3 changed files with 9 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
8 changes: 6 additions & 2 deletions test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ ui-unittest() {

install-postgres() {
info Installing postgres 🛢🛢🛢
apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
apt-get update
apt-get install -y postgresql postgresql-contrib
pg_ctlcluster 11 main start
apt-get -y install postgresql-13
service postgresql start
pg_ctlcluster 13 main start
}

set-pg-passwd() {
Expand Down

0 comments on commit a113ce3

Please sign in to comment.