etalab / transport-site

Rendre disponible, valoriser et améliorer les données transports
https://transport.data.gouv.fr
194 stars 30 forks source link

Test fragile #3169

Closed thbar closed 1 year ago

thbar commented 1 year ago

Vu en CI (https://app.circleci.com/pipelines/github/etalab/transport-site/7327/workflows/351c9ae5-a376-432f-a4c5-1f7d43dfba95/jobs/40513/parallel-runs/0/steps/0-126).

==> transport
Excluding tags: [:pending]

.................................................................................................................................................................................................................................................................................................

  1) test get with an existing conversion (TransportWeb.ConversionControllerTest)
     apps/transport/test/transport_web/controllers/conversion_controller_test.exs:29
     match (=) failed
     The following variables were pinned:
       target = "resource_id:152"
       period = ~U[2023-05-22 00:00:00Z]
     code:  assert [%DB.Metrics{target: ^target, event: "conversions:get:GeoJSON", period: ^period, count: 1}] =
              DB.Metrics |> DB.Repo.all()
     left:  [
              %DB.Metrics{
                target: ^target,
                event: "conversions:get:GeoJSON",
                period: ^period,
                count: 1
              }
            ]
     right: []
     stacktrace:
       test/transport_web/controllers/conversion_controller_test.exs:69: (test)

.....11:57:46.633 [error] Task #PID<0.4789.0> started from #PID<0.4787.0> terminating
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.4789.0>.

When using ownership, you must manage connections in one
of the four ways:

* By explicitly checking out a connection
* By explicitly allowing a spawned process
* By running the pool in shared mode
* By using :caller option with allowed process

The first two options require every new process to explicitly
check a connection out or be allowed by calling checkout or
allow respectively.

The third option requires a {:shared, pid} mode to be set.
If using shared mode in tests, make sure your tests are not
async.

The fourth option requires [caller: pid] to be used when
checking out a connection from the pool. The caller process
should already be allowed on a connection.

If you are reading this error, it means you have not done one
of the steps above or that the owner process has crashed.

See Ecto.Adapters.SQL.Sandbox docs for more information.
    (ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:910: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto 3.9.5) lib/ecto/repo/schema.ex:756: Ecto.Repo.Schema.apply/4
    (ecto 3.9.5) lib/ecto/repo/schema.ex:369: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    (ecto 3.9.5) lib/ecto/repo/schema.ex:265: Ecto.Repo.Schema.insert!/4
    (elixir 1.14.3) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2
    (stdlib 3.17.2.2) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<3.128590276/0 in Transport.Telemetry.handle_event/4>
    Args: []
.......................................................................................................................................................................................................11:57:55.093 request_id=F2FuuK5MyUGpreIAAe2B [error] [__exception__: true, __struct__: MatchError, term: nil]
................................................................................................................................................thread 'main' panicked at 'The GTFS file is not well formated.: NotFileNorDirectory("")', src/main.rs:42:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
........................................................................................................................................
Finished in 42.2 seconds (17.3s async, 24.8s sync)
131 doctests, 643 tests, 1 failure
thbar commented 1 year ago

Je ne l'ai plus vu récemment, je clôture.