Skip to content

Commit 834c3bb

Browse files
Merge pull request #244 from gabriel-samfira/update-dependencies
Update dependencies and tests
2 parents 069bdd8 + 97d03dd commit 834c3bb

File tree

693 files changed

+86222
-28129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

693 files changed

+86222
-28129
lines changed

database/sql/enterprise_test.go

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ func (s *EnterpriseTestSuite) TestGetEnterpriseNotFound() {
244244

245245
func (s *EnterpriseTestSuite) TestGetEnterpriseDBDecryptingErr() {
246246
s.Fixtures.SQLMock.
247-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE name = ? COLLATE NOCASE AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
248-
WithArgs(s.Fixtures.Enterprises[0].Name).
247+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE name = ? COLLATE NOCASE AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
248+
WithArgs(s.Fixtures.Enterprises[0].Name, 1).
249249
WillReturnRows(sqlmock.NewRows([]string{"name"}).AddRow(s.Fixtures.Enterprises[0].Name))
250250

251251
_, err := s.StoreSQLMocked.GetEnterprise(context.Background(), s.Fixtures.Enterprises[0].Name)
@@ -292,8 +292,8 @@ func (s *EnterpriseTestSuite) TestDeleteEnterpriseInvalidEnterpriseID() {
292292

293293
func (s *EnterpriseTestSuite) TestDeleteEnterpriseDBDeleteErr() {
294294
s.Fixtures.SQLMock.
295-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
296-
WithArgs(s.Fixtures.Enterprises[0].ID).
295+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
296+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
297297
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
298298
s.Fixtures.SQLMock.ExpectBegin()
299299
s.Fixtures.SQLMock.
@@ -328,8 +328,8 @@ func (s *EnterpriseTestSuite) TestUpdateEnterpriseDBEncryptErr() {
328328
s.StoreSQLMocked.cfg.Passphrase = wrongPassphrase
329329

330330
s.Fixtures.SQLMock.
331-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
332-
WithArgs(s.Fixtures.Enterprises[0].ID).
331+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
332+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
333333
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
334334

335335
_, err := s.StoreSQLMocked.UpdateEnterprise(context.Background(), s.Fixtures.Enterprises[0].ID, s.Fixtures.UpdateRepoParams)
@@ -341,8 +341,8 @@ func (s *EnterpriseTestSuite) TestUpdateEnterpriseDBEncryptErr() {
341341

342342
func (s *EnterpriseTestSuite) TestUpdateEnterpriseDBSaveErr() {
343343
s.Fixtures.SQLMock.
344-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
345-
WithArgs(s.Fixtures.Enterprises[0].ID).
344+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
345+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
346346
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
347347
s.Fixtures.SQLMock.ExpectBegin()
348348
s.Fixtures.SQLMock.
@@ -362,8 +362,8 @@ func (s *EnterpriseTestSuite) TestUpdateEnterpriseDBDecryptingErr() {
362362
s.Fixtures.UpdateRepoParams.WebhookSecret = webhookSecret
363363

364364
s.Fixtures.SQLMock.
365-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
366-
WithArgs(s.Fixtures.Enterprises[0].ID).
365+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
366+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
367367
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
368368

369369
_, err := s.StoreSQLMocked.UpdateEnterprise(context.Background(), s.Fixtures.Enterprises[0].ID, s.Fixtures.UpdateRepoParams)
@@ -389,8 +389,8 @@ func (s *EnterpriseTestSuite) TestGetEnterpriseByIDInvalidEnterpriseID() {
389389

390390
func (s *EnterpriseTestSuite) TestGetEnterpriseByIDDBDecryptingErr() {
391391
s.Fixtures.SQLMock.
392-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
393-
WithArgs(s.Fixtures.Enterprises[0].ID).
392+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
393+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
394394
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
395395
s.Fixtures.SQLMock.
396396
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE `pools`.`enterprise_id` = ? AND `pools`.`deleted_at` IS NULL")).
@@ -446,11 +446,11 @@ func (s *EnterpriseTestSuite) TestCreateEnterprisePoolInvalidEnterpriseID() {
446446
func (s *EnterpriseTestSuite) TestCreateEnterprisePoolDBCreateErr() {
447447
s.Fixtures.SQLMock.ExpectBegin()
448448
s.Fixtures.SQLMock.
449-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
450-
WithArgs(s.Fixtures.Enterprises[0].ID).
449+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
450+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
451451
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
452452
s.Fixtures.SQLMock.
453-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT 1")).
453+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT ?")).
454454
WillReturnError(fmt.Errorf("mocked creating pool error"))
455455

456456
entity, err := s.Fixtures.Enterprises[0].GetEntity()
@@ -465,16 +465,16 @@ func (s *EnterpriseTestSuite) TestCreateEnterprisePoolDBCreateErr() {
465465
func (s *EnterpriseTestSuite) TestCreateEnterpriseDBPoolAlreadyExistErr() {
466466
s.Fixtures.SQLMock.ExpectBegin()
467467
s.Fixtures.SQLMock.
468-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
469-
WithArgs(s.Fixtures.Enterprises[0].ID).
468+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
469+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
470470
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
471471
s.Fixtures.SQLMock.
472-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT 1")).
472+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT ?")).
473473
WithArgs(
474474
s.Fixtures.CreatePoolParams.ProviderName,
475475
s.Fixtures.CreatePoolParams.Image,
476476
s.Fixtures.CreatePoolParams.Flavor,
477-
s.Fixtures.Enterprises[0].ID).
477+
s.Fixtures.Enterprises[0].ID, 1).
478478
WillReturnRows(sqlmock.NewRows([]string{"enterprise_id", "provider_name", "image", "flavor"}).
479479
AddRow(
480480
s.Fixtures.Enterprises[0].ID,
@@ -494,19 +494,19 @@ func (s *EnterpriseTestSuite) TestCreateEnterpriseDBPoolAlreadyExistErr() {
494494
func (s *EnterpriseTestSuite) TestCreateEnterprisePoolDBFetchTagErr() {
495495
s.Fixtures.SQLMock.ExpectBegin()
496496
s.Fixtures.SQLMock.
497-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
498-
WithArgs(s.Fixtures.Enterprises[0].ID).
497+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
498+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
499499
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
500500
s.Fixtures.SQLMock.
501-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT 1")).
501+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT ?")).
502502
WithArgs(
503503
s.Fixtures.CreatePoolParams.ProviderName,
504504
s.Fixtures.CreatePoolParams.Image,
505505
s.Fixtures.CreatePoolParams.Flavor,
506-
s.Fixtures.Enterprises[0].ID).
506+
s.Fixtures.Enterprises[0].ID, 1).
507507
WillReturnRows(sqlmock.NewRows([]string{"enterprise_id"}))
508508
s.Fixtures.SQLMock.
509-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `tags` WHERE name = ? AND `tags`.`deleted_at` IS NULL ORDER BY `tags`.`id` LIMIT 1")).
509+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `tags` WHERE name = ? AND `tags`.`deleted_at` IS NULL ORDER BY `tags`.`id` LIMIT ?")).
510510
WillReturnError(fmt.Errorf("mocked fetching tag error"))
511511

512512
entity, err := s.Fixtures.Enterprises[0].GetEntity()
@@ -522,19 +522,19 @@ func (s *EnterpriseTestSuite) TestCreateEnterprisePoolDBAddingPoolErr() {
522522
s.Fixtures.CreatePoolParams.Tags = []string{"linux"}
523523
s.Fixtures.SQLMock.ExpectBegin()
524524
s.Fixtures.SQLMock.
525-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
526-
WithArgs(s.Fixtures.Enterprises[0].ID).
525+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
526+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
527527
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
528528
s.Fixtures.SQLMock.
529-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT 1")).
529+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT ?")).
530530
WithArgs(
531531
s.Fixtures.CreatePoolParams.ProviderName,
532532
s.Fixtures.CreatePoolParams.Image,
533533
s.Fixtures.CreatePoolParams.Flavor,
534-
s.Fixtures.Enterprises[0].ID).
534+
s.Fixtures.Enterprises[0].ID, 1).
535535
WillReturnRows(sqlmock.NewRows([]string{"enterprise_id"}))
536536
s.Fixtures.SQLMock.
537-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `tags` WHERE name = ? AND `tags`.`deleted_at` IS NULL ORDER BY `tags`.`id` LIMIT 1")).
537+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `tags` WHERE name = ? AND `tags`.`deleted_at` IS NULL ORDER BY `tags`.`id` LIMIT ?")).
538538
WillReturnRows(sqlmock.NewRows([]string{"linux"}))
539539
s.Fixtures.SQLMock.
540540
ExpectExec(regexp.QuoteMeta("INSERT INTO `tags`")).
@@ -558,19 +558,19 @@ func (s *EnterpriseTestSuite) TestCreateEnterprisePoolDBSaveTagErr() {
558558

559559
s.Fixtures.SQLMock.ExpectBegin()
560560
s.Fixtures.SQLMock.
561-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
562-
WithArgs(s.Fixtures.Enterprises[0].ID).
561+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
562+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
563563
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
564564
s.Fixtures.SQLMock.
565-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT 1")).
565+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT ?")).
566566
WithArgs(
567567
s.Fixtures.CreatePoolParams.ProviderName,
568568
s.Fixtures.CreatePoolParams.Image,
569569
s.Fixtures.CreatePoolParams.Flavor,
570-
s.Fixtures.Enterprises[0].ID).
570+
s.Fixtures.Enterprises[0].ID, 1).
571571
WillReturnRows(sqlmock.NewRows([]string{"enterprise_id"}))
572572
s.Fixtures.SQLMock.
573-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `tags` WHERE name = ? AND `tags`.`deleted_at` IS NULL ORDER BY `tags`.`id` LIMIT 1")).
573+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `tags` WHERE name = ? AND `tags`.`deleted_at` IS NULL ORDER BY `tags`.`id` LIMIT ?")).
574574
WillReturnRows(sqlmock.NewRows([]string{"linux"}))
575575
s.Fixtures.SQLMock.
576576
ExpectExec(regexp.QuoteMeta("INSERT INTO `tags`")).
@@ -597,19 +597,19 @@ func (s *EnterpriseTestSuite) TestCreateEnterprisePoolDBFetchPoolErr() {
597597

598598
s.Fixtures.SQLMock.ExpectBegin()
599599
s.Fixtures.SQLMock.
600-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT 1")).
601-
WithArgs(s.Fixtures.Enterprises[0].ID).
600+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `enterprises` WHERE id = ? AND `enterprises`.`deleted_at` IS NULL ORDER BY `enterprises`.`id` LIMIT ?")).
601+
WithArgs(s.Fixtures.Enterprises[0].ID, 1).
602602
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow(s.Fixtures.Enterprises[0].ID))
603603
s.Fixtures.SQLMock.
604-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT 1")).
604+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE (provider_name = ? and image = ? and flavor = ? and enterprise_id = ?) AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT ?")).
605605
WithArgs(
606606
s.Fixtures.CreatePoolParams.ProviderName,
607607
s.Fixtures.CreatePoolParams.Image,
608608
s.Fixtures.CreatePoolParams.Flavor,
609-
s.Fixtures.Enterprises[0].ID).
609+
s.Fixtures.Enterprises[0].ID, 1).
610610
WillReturnRows(sqlmock.NewRows([]string{"enterprise_id"}))
611611
s.Fixtures.SQLMock.
612-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `tags` WHERE name = ? AND `tags`.`deleted_at` IS NULL ORDER BY `tags`.`id` LIMIT 1")).
612+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `tags` WHERE name = ? AND `tags`.`deleted_at` IS NULL ORDER BY `tags`.`id` LIMIT ?")).
613613
WillReturnRows(sqlmock.NewRows([]string{"linux"}))
614614
s.Fixtures.SQLMock.
615615
ExpectExec(regexp.QuoteMeta("INSERT INTO `tags`")).
@@ -628,7 +628,7 @@ func (s *EnterpriseTestSuite) TestCreateEnterprisePoolDBFetchPoolErr() {
628628
WillReturnResult(sqlmock.NewResult(1, 1))
629629
s.Fixtures.SQLMock.ExpectCommit()
630630
s.Fixtures.SQLMock.
631-
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE id = ? AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT 1")).
631+
ExpectQuery(regexp.QuoteMeta("SELECT * FROM `pools` WHERE id = ? AND `pools`.`deleted_at` IS NULL ORDER BY `pools`.`id` LIMIT ?")).
632632
WillReturnRows(sqlmock.NewRows([]string{"id"}))
633633

634634
entity, err := s.Fixtures.Enterprises[0].GetEntity()

0 commit comments

Comments
 (0)