benoitdm-oslandia / pg_featureserv

Apache License 2.0
1 stars 0 forks source link

Implementation of the sequential test mechanism - [merged] #120

Closed benoitdm-oslandia closed 1 year ago

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 12, 2022, 17:05

_Merges feature/sequentialtests -> develop

Ref #48 : Implémentation du mécanisme de tests séquentiels (ordre d’exécution) pour le mode db et mock


Structure d'un fichier Runner :

package db_test

type DbTests struct {
  Test *testing.T
}

func TestMain(m *testing.M) {
  // some stuff...
}

func TestRunnerHandlerDb(t *testing.T) {

  // initialisation avant l'execution des tests
  beforeRun()

  // liste de tests sur la suppression des features
  t.Run("DELETE", func(t *testing.T) {
    beforeEachRun()
    test := DbTests{Test: t}
    test.TestDeleteFeatureDb()
    afterEachRun()
  })

  // nettoyage après execution des tests
  afterRun()
}

Ex. d'une fonction de test :

func (t *DbTests) TestDeleteFeatureDb() {
  // some stuff...
}

Autre ex. de fonction de test :

func (t *DbTests) TestDeleteFeatureDb() {
  t.Test.Run("TestDeleteFeatureDb", func(t *testing.T) {
    // some stuff...
  })
}

Il est toujours possible d'ajouter des tests classiques sans passer par un runner.

Comment lancer les tests ?

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 12, 2022, 17:11

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 12, 2022, 17:18

@benoitdm-oslandia pourquoi le test "TestProperDbInit" sur la CI nous dit qu'il y'a 5 tables alors qu'il ne peut en avoir que 4 (mock_a, mock_b, mock_c et mock_multi) !?

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 12, 2022, 22:52

added 4 commits

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 12, 2022, 22:53

requested review from @benoitdm-oslandia

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 12, 2022, 22:58

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 12, 2022, 23:43

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 12:58

added 3 commits

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 13:31

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

parce que il lit une table système qui n'est pas exclue ("tiger.tabblock20") mais qui le devrait

benoitdm-oslandia commented 1 year ago

Avant de faire la review ton explication dans le corps de ticket mériterait de partir dans un fichier de doc hugo ! Nouvelle tâche pour toi :smile:

benoitdm-oslandia commented 1 year ago

comment cette indentation pourrie a pu passer les checks ??

benoitdm-oslandia commented 1 year ago

pour le coup j'en ai aussi 5 en local

benoitdm-oslandia commented 1 year ago

je voulais le faire mais j'avais la flemme :smile:

benoitdm-oslandia commented 1 year ago

pourquoi ?

benoitdm-oslandia commented 1 year ago

Good job !

Si le changement de chemin de assets est lié au déplacement des tests alors il faut trouver une solution qui prenne trouve les assets quelque soit l'appelant.

Sinon top!

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 16:12

hummm..., du coup, ce test est un peu pourri !?

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 16:14

Commented on internal/service/db_test/handler_db_test.go line 34

pas terrible comme test si les tables sys ne sont pas écartées...

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 16:14

Commented on internal/util/test_http.go line 54

changement de niveau des tests dans la structure de fichier...

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 16:17

resolved all threads

benoitdm-oslandia commented 1 year ago

oui on pourrait l'ajouter par défaut dans les tables exclue ou bien modifier le fichier de conf utilisée pour la spécifier précisément

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 16:49

c'est une conf uniquement valable pour les tests..., a t on besoin de rendre le truc dynamique ?

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 16:54

Commented on internal/service/db_test/handler_db_test.go line 34

changed this line in version 9 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 16:54

added 4 commits

Compare with previous version

benoitdm-oslandia commented 1 year ago

le truc ne me semblait pas complexe mais je réfléchissait en python où c assez simple à faire.

Est ce que tu peux jeter un coup d'oeil rapide stp ?

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 17:15

Commented on internal/util/test_http.go line 54

changed this line in version 10 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 17:15

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 17:16

le truc rapide, c'est d'ajouter les assets en param.

cf. last commit

benoitdm-oslandia commented 1 year ago

très bien

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 17:25

resolved all threads

benoitdm-oslandia commented 1 year ago

@lowzonenose est ce que tu peux ajouter ton explication dans le corps de ticket dans un fichier de doc hugo stp ?

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 17:59

ok, je vais essayer de trouver un emplacement pour documenter les tests.

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 21:25

added 2 commits

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 21:27

resolved all threads

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 13, 2022, 21:31

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago
    go test -v $(go list ./... | grep -v /vendor/)
benoitdm-oslandia commented 1 year ago
  go test -v $(go list ./... | grep -v /vendor/)
benoitdm-oslandia commented 1 year ago

Bon très bien, il faudra squasher une partie des commits (comme les 2 derniers) et puis c'est bon

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 14, 2022, 10:47

Commented on hugo/content/installation/installing.md line 61

cette commande va exécuter les tests sur la BDD.

Et, il y'a des conditions à leurs exécutions, il faut exposer DATABASE_URL.

choix ?

benoitdm-oslandia commented 1 year ago

ok ! Conditions qu'il faudra d'ailleurs documenter :/

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 14, 2022, 11:21

Commented on Makefile line 43

changed this line in version 13 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 14, 2022, 11:21

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 14, 2022, 11:27

resolved all threads

benoitdm-oslandia commented 1 year ago

In GitLab by @lowzonenose on Oct 14, 2022, 11:28

approved this merge request

benoitdm-oslandia commented 1 year ago

j'ai eu un pbm de lecture ... il me manquait des bouts tout à l'heure :

je veix bien que tu remplaces par :

go test -v $(go list ./... | grep -vw db_test)

benoitdm-oslandia commented 1 year ago

resolved all threads