elixir
elixir copied to clipboard
ex_unit exception
Elixir and Erlang/OTP versions
Erlang/OTP 26 [erts-14.2.4] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Elixir 1.16.2 (compiled with Erlang/OTP 26)
Operating system
macos 13.6.4 (22G513)
Current behavior
I do this in a test:
assert [
%Jump.IntegrationSchema{
record_type: "Account",
label: "Account",
fields: [
%Jump.IntegrationSchema.Field{
id: nil,
name: "id",
label: "Id",
kind: :integer,
computed: true,
readonly: true,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: nil,
show_on_create: false,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "number",
label: "Number",
kind: :string,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: nil,
show_on_create: true,
required_to_create: true
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "contact_id",
label: "Contact",
kind: :reference,
computed: false,
readonly: false,
nullable: false,
reference_types: ["Contact"],
max_length: nil,
scale: nil,
options: nil,
show_on_create: true,
required_to_create: true
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "status",
label: "Status",
kind: :string,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: nil,
show_on_create: true,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "balance",
label: "Balance",
kind: :string,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: nil,
show_on_create: true,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "company",
label: "Company",
kind: :string,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: nil,
show_on_create: true,
required_to_create: true
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "product",
label: "Product",
kind: :string,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: nil,
show_on_create: true,
required_to_create: true
}
]
},
%Jump.IntegrationSchema{
fields: [
%Jump.IntegrationSchema.Field{
computed: true,
id: nil,
kind: :integer,
label: "Id",
max_length: nil,
name: "id",
nullable: false,
options: nil,
readonly: true,
reference_types: [],
required_to_create: false,
scale: nil,
show_on_create: false
},
%Jump.IntegrationSchema.Field{
computed: false,
id: nil,
kind: :string,
label: "Subject",
max_length: nil,
name: "subject",
nullable: false,
options: nil,
readonly: false,
reference_types: [],
required_to_create: true,
scale: nil,
show_on_create: true
},
%Jump.IntegrationSchema.Field{
computed: false,
id: nil,
kind: :datetime,
label: "Start Date",
max_length: nil,
name: "start_date",
nullable: false,
options: nil,
readonly: false,
reference_types: [],
required_to_create: true,
scale: nil,
show_on_create: true
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "end_date",
label: "End Date",
kind: :datetime,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: nil,
show_on_create: true,
required_to_create: true
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "description",
label: "Description",
kind: :textarea,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: nil,
show_on_create: true,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "linked_contacts",
label: "Linked Contacts",
kind: :references,
computed: true,
readonly: true,
nullable: true,
reference_types: ["Contact"],
max_length: nil,
scale: nil,
options: [],
show_on_create: true,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "note_associations",
label: "Notes",
kind: :references,
computed: true,
readonly: true,
nullable: true,
reference_types: ["Note"],
max_length: nil,
scale: nil,
options: [],
show_on_create: true,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "share_with_client",
label: "Share with client",
kind: :boolean,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: [],
show_on_create: true,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "all_day",
label: "All day",
kind: :boolean,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: [],
show_on_create: true,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "location",
label: "Location",
kind: :string,
computed: false,
readonly: false,
nullable: false,
reference_types: [],
max_length: nil,
scale: nil,
options: [],
show_on_create: true,
required_to_create: false
},
%Jump.IntegrationSchema.Field{
id: nil,
name: "category",
label: "Category",
kind: :select,
computed: false,
readonly: false,
nullable: true,
reference_types: [],
max_length: nil,
scale: nil,
options: [
"Customer Service<:jump:>g2EE",
"General Information<:jump:>g2EC",
"Policy Support<:jump:>g2ED",
"Technical Support<:jump:>g2EG",
"Underwriting Information<:jump:>g2EF"
],
show_on_create: true,
required_to_create: false
}
],
label: "Activity",
record_type: "Activity"
}
| _
] = IntegrationSchema |> order_by(:record_type) |> Repo.all()
and the test crashes with
mix test lib/jump/integrations/crms/jobs/update_schema_test.exs:628 -- INSERT --
"Starting Jump app"
Excluding tags: [:test]
Including tags: [location: {"lib/jump/integrations/crms/jobs/update_schema_test.exs", 628}]
09:25:17.376 [error] GenServer #PID<0.914.0> terminating
** (BadFunctionError) expected a function, got: false
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1007: ExUnit.Diff.safe_to_algebra/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1025: ExUnit.Diff.safe_keyword_to_algebra/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:480: ExUnit.Formatter.format_sides/6
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:462: ExUnit.Formatter.format_assertion_diff/4
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:373: ExUnit.Formatter.format_exception/6
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:270: anonymous fn/7 in ExUnit.Formatter.format_test_failure/5
(elixir 1.16.2) lib/enum.ex:1801: anonymous fn/2 in Enum.map_join/3
(elixir 1.16.2) lib/enum.ex:4378: Enum.map_intersperse_list/3
(elixir 1.16.2) lib/enum.ex:1801: Enum.map_join/3
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:269: ExUnit.Formatter.format_test_failure/5
(ex_unit 1.16.2) lib/ex_unit/cli_formatter.ex:109: ExUnit.CLIFormatter.handle_cast/2
(stdlib 5.2.2) gen_server.erl:1121: :gen_server.try_handle_cast/3
Last message: {:"$gen_cast", {:test_finished, %ExUnit.Test{name: :"test import schema from redtail", case: Jump.Integrations.Jobs.UpdateSchemaTest, module: Jump.Integrations.Jobs.UpdateSchemaTest, state: {:failed, [{:error, %ExUnit.AssertionError{left: [{:%, [line: 344, column: 14], [Jump.IntegrationSchema, {:%{}, [line: 344, column: 37], [record_type: "Account", label: "Account", fields: [{:%, [line: 348, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 348, column: 47], [id: nil, name: "id", label: "Id", kind: :integer, computed: true, readonly: true, nullable: false, reference_types: [], max_length: nil, scale: nil, options: nil, show_on_create: false, required_to_create: false]}]}, {:%, [line: 363, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 363, column: 47], [id: nil, name: "number", label: "Number", kind: :string, computed: false, readonly: false, nullable: false, reference_types: [], max_length: nil, scale: nil, options: nil, show_on_create: true, required_to_create: true]}]}, {:%, [line: 378, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 378, column: 47], [id: nil, name: "contact_id", label: "Contact", kind: :reference, computed: false, readonly: false, nullable: false, reference_types: ["Contact"], max_length: nil, scale: nil, options: nil, show_on_create: true, required_to_create: true]}]}, {:%, [line: 393, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 393, column: 47], [id: nil, name: "status", label: "Status", kind: :string, computed: false, readonly: false, nullable: false, reference_types: [], max_length: nil, scale: nil, options: nil, show_on_create: true, ...]}]}, {:%, [line: 408, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 408, column: 47], [id: nil, name: "balance", label: "Balance", kind: :string, computed: false, readonly: false, nullable: false, reference_types: [], max_length: nil, scale: nil, options: nil, ...]}]}, {:%, [line: 423, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 423, column: 47], [id: nil, name: "company", label: "Company", kind: :string, computed: false, readonly: false, nullable: false, reference_types: [], max_length: nil, scale: nil, ...]}]}, {:%, [line: 438, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 438, column: 47], [id: nil, name: "product", label: "Product", kind: :string, computed: false, readonly: false, nullable: false, reference_types: [], max_length: nil, ...]}]}]]}]}, {:|, [line: 632, column: 14], [{:%, [line: 455, column: 14], [Jump.IntegrationSchema, {:%{}, [line: 455, column: 37], [fields: [{:%, [line: 457, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 457, column: 47], [computed: true, id: nil, kind: :integer, label: "Id", max_length: nil, name: "id", nullable: false, options: nil, readonly: true, reference_types: [], required_to_create: false, scale: nil, ...]}]}, {:%, [line: 472, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 472, column: 47], [computed: false, id: nil, kind: :string, label: "Subject", max_length: nil, name: "subject", nullable: false, options: nil, readonly: false, reference_types: [], required_to_create: true, ...]}]}, {:%, [line: 487, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 487, column: 47], [computed: false, id: nil, kind: :datetime, label: "Start Date", max_length: nil, name: "start_date", nullable: false, options: nil, readonly: false, reference_types: [], ...]}]}, {:%, [line: 502, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 502, column: 47], [id: nil, name: "end_date", label: "End Date", kind: :datetime, computed: false, readonly: false, nullable: false, reference_types: [], max_length: nil, ...]}]}, {:%, [line: 517, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 517, column: 47], [id: nil, name: "description", label: "Description", kind: :textarea, computed: false, readonly: false, nullable: false, reference_types: [], ...]}]}, {:%, [line: 532, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 532, column: 47], [id: nil, name: "linked_contacts", label: "Linked Contacts", kind: :references, computed: true, readonly: true, nullable: true, ...]}]}, {:%, [line: 547, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 547, column: 47], [id: nil, name: "note_associations", label: "Notes", kind: :references, computed: true, readonly: true, ...]}]}, {:%, [line: 562, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 562, column: 47], [id: nil, name: "share_with_client", label: "Share with client", kind: :boolean, computed: false, ...]}]}, {:%, [line: 577, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 577, column: 47], [id: nil, name: "all_day", label: "All day", kind: :boolean, ...]}]}, {:%, [line: 592, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 592, column: 47], [id: nil, name: "location", label: "Location", ...]}]}, {:%, [line: 607, column: 18], [Jump.IntegrationSchema.Field, {:%{}, [line: 607, column: 47], [id: nil, name: "category", ...]}]}], label: "Activity", record_type: "Activity"]}]}, {:_, [line: 632, column: 16], nil}]}], right: [%Jump.IntegrationSchema{__meta__: #Ecto.Schema.Metadata<:loaded, "integration_schemas">, id: "int_sch_11333438ccb340c2b2c", record_type: "Account", label: "Account", fields: [%Jump.IntegrationSchema.Field{id: nil, name: "id", label: "Id", kind: :integer, computed: true, custom: false, readonly: true, nullable: false, reference_types: [], max_length: nil, scale: nil, options: nil, show_on_create: false, required_to_create: false, default_value: nil}, %Jump.IntegrationSchema.Field{id: nil, name: "number", label: "Number", kind: :string, computed: false, custom: false, readonly: false, nullable: false, reference_types: [], max_length: nil, scale: nil, options: nil, show_on_create: true, required_to_create: true, default_value: nil}, %Jump.IntegrationSchema.Field{id: nil, name: "contact_id", label: "Contact", kind: :reference, computed: false, custom: false, readonly: false, nullable: false, reference_types: ["Contact"], max_length: nil, scale: nil, options: nil, show_on_create: true, required_to_create: true, default_value: nil}, %Jump.IntegrationSchema.Field{id: nil, name: "status", label: "Status", kind: :string, computed: false, custom: false, readonly: false, nullable: false, reference_types: [], max_length: nil, scale: nil, options: nil, show_on_create: true, required_to_create: false, default_value: nil}, %Jum (truncated)
09:25:17.392 [error] Task #PID<0.907.0> started from #PID<0.98.0> terminating
** (stop) exited in: GenServer.stop(#PID<0.914.0>, :normal, :infinity)
** (EXIT) exited in: :sys.terminate(#PID<0.914.0>, :normal, :infinity)
** (EXIT) an exception was raised:
** (BadFunctionError) expected a function, got: false
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1007: ExUnit.Diff.safe_to_algebra/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1025: ExUnit.Diff.safe_keyword_to_algebra/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:480: ExUnit.Formatter.format_sides/6
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:462: ExUnit.Formatter.format_assertion_diff/4
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:373: ExUnit.Formatter.format_exception/6
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:270: anonymous fn/7 in ExUnit.Formatter.format_test_failure/5
(elixir 1.16.2) lib/enum.ex:1801: anonymous fn/2 in Enum.map_join/3
(elixir 1.16.2) lib/enum.ex:4378: Enum.map_intersperse_list/3
(elixir 1.16.2) lib/enum.ex:1801: Enum.map_join/3
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:269: ExUnit.Formatter.format_test_failure/5
(ex_unit 1.16.2) lib/ex_unit/cli_formatter.ex:109: ExUnit.CLIFormatter.handle_cast/2
(stdlib 5.2.2) gen_server.erl:1121: :gen_server.try_handle_cast/3
(elixir 1.16.2) lib/gen_server.ex:1071: GenServer.stop/3
(ex_unit 1.16.2) lib/ex_unit/event_manager.ex:22: anonymous fn/2 in ExUnit.EventManager.stop/1
(elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(ex_unit 1.16.2) lib/ex_unit/event_manager.ex:21: ExUnit.EventManager.stop/1
(ex_unit 1.16.2) lib/ex_unit/runner.ex:61: ExUnit.Runner.run_with_trap/2
(ex_unit 1.16.2) lib/ex_unit/runner.ex:30: ExUnit.Runner.run/2
(elixir 1.16.2) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
(elixir 1.16.2) lib/task/supervised.ex:36: Task.Supervised.reply/4
Function: #Function<0.126615300/0 in ExUnit.async_run/0>
Args: []
** (EXIT from #PID<0.98.0>) exited in: GenServer.stop(#PID<0.914.0>, :normal, :infinity)
** (EXIT) exited in: :sys.terminate(#PID<0.914.0>, :normal, :infinity)
** (EXIT) an exception was raised:
** (BadFunctionError) expected a function, got: false
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1007: ExUnit.Diff.safe_to_algebra/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1025: ExUnit.Diff.safe_keyword_to_algebra/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.16.2) lib/enum.ex:1700: Enum."-map/2-lists^map/1-1-"/2
(ex_unit 1.16.2) lib/ex_unit/diff.ex:1053: ExUnit.Diff.container_to_algebra/5
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:480: ExUnit.Formatter.format_sides/6
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:462: ExUnit.Formatter.format_assertion_diff/4
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:373: ExUnit.Formatter.format_exception/6
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:270: anonymous fn/7 in ExUnit.Formatter.format_test_failure/5
(elixir 1.16.2) lib/enum.ex:1801: anonymous fn/2 in Enum.map_join/3
(elixir 1.16.2) lib/enum.ex:4378: Enum.map_intersperse_list/3
(elixir 1.16.2) lib/enum.ex:1801: Enum.map_join/3
(ex_unit 1.16.2) lib/ex_unit/formatter.ex:269: ExUnit.Formatter.format_test_failure/5
(ex_unit 1.16.2) lib/ex_unit/cli_formatter.ex:109: ExUnit.CLIFormatter.handle_cast/2
(stdlib 5.2.2) gen_server.erl:1121: :gen_server.try_handle_cast/3
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
[os_mon] memory supervisor port (memsup): Erlang has closed
Expected behavior
The test shouldn't crash :)
worth noting it doesn't crash when running in a github action… just on my mac
if it helps, if I add an item to the end of fields at the end (after category), it doesn't crash and shows the diff
Do you have the exact same versions for Erlang and Elixir as CI?
if yes and it persists, we will need a way to reproduce this. I think a small project that defines those as structs (without Ecto) and replace the right side of = by a function call that returns hardcoded structs too :)
thanks!
Ping!
I will close this for now, as we prepare for v1.17. We will gladly reopen if there is a way to reproduce it. :)