Skip to content

2.4.0 Breaks Seeding of Data for Testing #1462

Closed
@allenwyma

Description

Describe the bug
I created a seeding function for seeding data that looks like ExMachina:

@spec insert(atom(), Enumerable.t()) :: struct()
  def insert(resource_atom, overrides \\ %{}) do
    overrides = Enum.into(overrides, %{})

    resource_atom
    |> resource()
    |> Map.merge(overrides)
    |> Ash.Seed.seed!()
  end

2.4.0 breaks with returning, using latest main is putting nil values and failing. Rolling back to 2.3.1 solves the problem.

To Reproduce

defp resource(:user) do
    %App.Accounts.User{
      email: Faker.Internet.email(),
      last_name: Faker.Person.En.last_name(),
      first_name: Faker.Person.En.first_name(),
      photo_url: Faker.Avatar.image_url()
    }
  end

Expected behavior
Factory gets inserted and test runs

** Runtime

  • Elixir version 1.17.2
  • Erlang version 27.0.1
  • OS MacOS
  • Ash version 3.4.11
  • any related extension versions ash_postgres: 2.4.0 or latest main

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions