Skip to content

AstarteE2E application crashes if Realm already exists #1647

Description

@guicrocetti

The AstarteE2E application fails to start if the Astarte Realm it attempts to create already exists, throwing a 409 Conflict error upon startup.

This current behavior breaks compatibility with older astarte_e2e versions where the Realm might have been provisioned beforehand. This difficulty significantly hinders the path to upgrade astarte_e2e in stable test setups where the Realm persists.

level=info ts=2025-12-01T11:42:45.601+00:00 msg="Starting AstarteE2E application." module=AstarteE2E.Application function=start/2 tag=application_start
level=notice ts=2025-12-01T11:42:45.882+00:00 msg="Application astarte_e2e exited: exited in: AstarteE2E.Application.start(:normal, [])\n    ** (EXIT) an exception was raised:\n        ** (RuntimeError) Failed to create realm: 409 {\"errors\":{\"detail\":\"Realm already exists\"}}\n            (astarte_e2e 1.2.0) lib/astarte_e2e/realm.ex:51: AstarteE2E.Realm.create_realm!/0\n            (astarte_e2e 1.2.0) lib/astarte_e2e/application.ex:35: AstarteE2E.Application.start/2\n            (kernel 9.1) application_master.erl:293: :application_master.start_it_old/4" module=application_controller function=info_exited/3
Kernel pid terminated (application_controller) ("{application_start_failure,astarte_e2e,{bad_return,{{'Elixir.AstarteE2E.Application',start,[normal,[]]},{'EXIT',{#{message => <<\"Failed to create realm: 409 {\\"errors\\":{\\"detail\\":\\"Realm already exists\\"}}\">>,'__struct__' => 'Elixir.RuntimeError','__exception__' => true},[{'Elixir.AstarteE2E.Realm','create_realm!',0,[{file,\"lib/astarte_e2e/realm.ex\"},{line,51},{error_info,#{module => 'Elixir.Exception'}}]},{'Elixir.AstarteE2E.Application',start,2,[{file,\"lib/astarte_e2e/application.ex\"},{line,35}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,293}]}]}}}}}")

Crash dump is being written to: erl_crash.dump...done
stream closed: EOF for e2e/astarte-e2e-m-int-clea-dev-7984c5f857-lqgvm (e2e)

AstarteE2E version: astarte/astarte_e2e:1.3.0-rc.0@sha256:b4f7087e41772c73697f9548295bb9ae03db77156c2b735a178fe484a7839d5a

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions