Tests failed when running "mix test"

Hi,
I’m trying to understand the Farmbot OS so I can start altering it. I’ve installed everything on an Ubuntu machine and have managed to compile it okay (with “host” and “dev”) although I noticed quite a few warnings, there were no errors.

I changed to “host” and “test” and ran “mix test” with the output shown below. My config/host/auth_secret_test.exs is pointing to the server “https://my.farmbot.io/” and I’ve checked my credentials are correct.

First I had some problems running “mix test” connecting to my own copy of the website stack at localhost: I got the error “backend port not found :inotifywait” but I’m not so worried about that.

So, with the server set to “https://my.farmbot.io/” There were 12 test failures and I’m wondering if you could suggest anything I might be doing wrong. I’m new to Elixir/Mix although I have extensive experience with Prolog and Lisp so it’s really the layout the way mix works that’s tricking me a bit (I’m most of the way through the tutorial though).

ubuntu@ip-172-31-30-3:~/farmbot_os$ mix test
Env
MIX_TARGET: host
MIX_ENV: test

Compiling 208 files (.ex)
warning: function requires_reboot?/0 required by behaviour Farmbot.System.UpdateHandler is not implemented (in module FarmbotTestSupport.TestUpdateHandler)
test/support/test_update_handler.ex:1

warning: function FarmbotTestSupport.TestUpdateHandler.requires_reboot?/0 is undefined or private
lib/farmbot/system/updates/updates.ex:25

Generated farmbot app

04:40:00.319 [info] == Running Farmbot.Repo.Migrations.AddFarmEventsTable.change/0 forward

04:40:00.321 [info] create table farm_events

04:40:00.329 [info] create index farm_events_id_index

04:40:00.330 [info] == Migrated in 0.0s

04:40:00.365 [info] == Running Farmbot.Repo.Migrations.AddPeripheralsTable.change/0 forward

04:40:00.365 [info] create table peripherals

04:40:00.365 [info] create index peripherals_id_index

p04:40:00.366 [info] == Migrated in 0.0s

04:40:00.394 [info] == Running Farmbot.Repo.Migrations.AddSequencesTable.change/0 forward

04:40:00.394 [info] create table sequences

04:40:00.394 [info] create index sequences_id_index

04:40:00.395 [info] == Migrated in 0.0s

04:40:00.418 [info] == Running Farmbot.Repo.Migrations.AddRegimensTable.change/0 forward

04:40:00.418 [info] create table regimens

04:40:00.418 [info] create index regimens_id_index

04:40:00.419 [info] == Migrated in 0.0s

04:40:00.447 [info] == Running Farmbot.Repo.Migrations.AddToolsTable.change/0 forward

04:40:00.447 [info] create table tools

04:40:00.451 [info] create index tools_id_index

04:40:00.457 [info] == Migrated in 0.0s

04:40:00.481 [info] == Running Farmbot.Repo.Migrations.AddToolSlotsTable.change/0 forward

04:40:00.481 [info] create table tool_slots

04:40:00.484 [info] create index tool_slots_id_index

04:40:00.485 [info] == Migrated in 0.0s

04:40:00.507 [info] == Running Farmbot.Repo.Migrations.AddPointsTable.change/0 forward

04:40:00.509 [info] create table points

04:40:00.510 [info] create index points_id_index

04:40:00.510 [info] == Migrated in 0.0s

04:40:00.536 [info] == Running Farmbot.Repo.Migrations.AddGenericPointersTable.change/0 forward

04:40:00.536 [info] create table generic_pointers

04:40:00.537 [info] create index generic_pointers_id_index

04:40:00.538 [info] == Migrated in 0.0s

04:40:00.567 [info] == Running Farmbot.Repo.A.Migrations.AddDevicesTable.change/0 forward

04:40:00.567 [info] create table devices

04:40:00.571 [info] create index devices_id_index

04:40:00.574 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.Migrations.AddFarmEventsTable (current version defined in memory)
priv/repo/migrations/20170919150432_add_farm_events_table.exs:1

04:40:00.609 [info] == Running Farmbot.Repo.Migrations.AddFarmEventsTable.change/0 forward

04:40:00.609 [info] create table farm_events

04:40:00.615 [info] create index farm_events_id_index

04:40:00.616 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.Migrations.AddPeripheralsTable (current version defined in memory)
priv/repo/migrations/20170920025503_add_peripherals_table.exs:1

04:40:00.633 [info] == Running Farmbot.Repo.Migrations.AddPeripheralsTable.change/0 forward

04:40:00.634 [info] create table peripherals

04:40:00.634 [info] create index peripherals_id_index

04:40:00.635 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.Migrations.AddSequencesTable (current version defined in memory)
priv/repo/migrations/20170920182759_add_sequences_table.exs:1

04:40:00.656 [info] == Running Farmbot.Repo.Migrations.AddSequencesTable.change/0 forward

04:40:00.656 [info] create table sequences

04:40:00.656 [info] create index sequences_id_index

04:40:00.657 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.Migrations.AddRegimensTable (current version defined in memory)
priv/repo/migrations/20170920182805_add_regimens_table.exs:1

04:40:00.676 [info] == Running Farmbot.Repo.Migrations.AddRegimensTable.change/0 forward

04:40:00.676 [info] create table regimens

04:40:00.677 [info] create index regimens_id_index

04:40:00.677 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.Migrations.AddToolsTable (current version defined in memory)
priv/repo/migrations/20170920182817_add_tools_table.exs:1

04:40:00.699 [info] == Running Farmbot.Repo.Migrations.AddToolsTable.change/0 forward

04:40:00.699 [info] create table tools

04:40:00.699 [info] create index tools_id_index

04:40:00.704 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.Migrations.AddToolSlotsTable (current version defined in memory)
priv/repo/migrations/20170920182827_add_tool_slots_table.exs:1

04:40:00.719 [info] == Running Farmbot.Repo.Migrations.AddToolSlotsTable.change/0 forward

04:40:00.719 [info] create table tool_slots

04:40:00.719 [info] create index tool_slots_id_index

04:40:00.720 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.Migrations.AddPointsTable (current version defined in memory)
priv/repo/migrations/20170920182853_add_points_table.exs:1

04:40:00.736 [info] == Running Farmbot.Repo.Migrations.AddPointsTable.change/0 forward

04:40:00.736 [info] create table points

04:40:00.736 [info] create index points_id_index

04:40:00.737 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.Migrations.AddGenericPointersTable (current version defined in memory)
priv/repo/migrations/20170920183526_add_generic_pointers_table.exs:1

04:40:00.766 [info] == Running Farmbot.Repo.Migrations.AddGenericPointersTable.change/0 forward

04:40:00.766 [info] create table generic_pointers

04:40:00.767 [info] create index generic_pointers_id_index

04:40:00.767 [info] == Migrated in 0.0s
warning: redefining module Farmbot.Repo.A.Migrations.AddDevicesTable (current version defined in memory)
priv/repo/migrations/20171025231225_add_devices_table.exs:1

04:40:00.788 [info] == Running Farmbot.Repo.A.Migrations.AddDevicesTable.change/0 forward

04:40:00.788 [info] create table devices

04:40:00.789 [info] create index devices_id_index

04:40:00.790 [info] == Migrated in 0.0s

04:40:00.838 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddEAVTables.change/0 forward

04:40:00.838 [info] create table groups

04:40:00.841 [info] create table string_values

04:40:00.841 [info] create table bool_values

04:40:00.842 [info] create table float_values

04:40:00.842 [info] create table configs

04:40:00.843 [info] create table network_interfaces

04:40:00.843 [info] == Migrated in 0.0s

04:40:00.891 [info] == Running Farmbot.System.ConfigStorage.Migrations.SeedGroups.change/0 forward

04:40:01.174 [info] == Migrated in 0.2s

04:40:01.210 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddDevicesTable.change/0 forward

04:40:01.210 [info] create table farmware_repositories

04:40:01.210 [info] create index farmware_repositories_url_index

04:40:01.211 [info] == Migrated in 0.0s

04:40:01.238 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddSyncCmdTable.change/0 forward

04:40:01.241 [info] create table sync_cmds

04:40:01.242 [info] == Migrated in 0.0s

04:40:01.271 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddGpioRegistry.change/0 forward

04:40:01.271 [info] create table gpio_registry

04:40:01.275 [info] == Migrated in 0.0s

04:40:01.309 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddFactoryResetSettings.change/0 forward

04:40:01.316 [info] == Migrated in 0.0s

04:40:01.333 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddSequenceCompleteLogOption.change/0 forward

04:40:01.342 [info] == Migrated in 0.0s

04:40:01.363 [info] == Running Farmbot.System.ConfigStorage.Migrations.ArduinoDebugParam.change/0 forward

04:40:01.365 [info] == Migrated in 0.0s

04:40:01.395 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddFirmwareIoLog.change/0 forward

04:40:01.399 [info] == Migrated in 0.0s

04:40:01.428 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddAmqpBootupLog.change/0 forward

04:40:01.431 [info] == Migrated in 0.0s

04:40:01.448 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddBetaChanelConfig.change/0 forward

04:40:01.453 [info] == Migrated in 0.0s

04:40:01.472 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddSpecialFwMigrationConfig.change/0 forward

04:40:01.483 [info] == Migrated in 0.0s

04:40:01.501 [info] == Running Farmbot.System.ConfigStorage.Migrations.AddApiMigratedFlag.change/0 forward

04:40:01.513 [info] == Migrated in 0.0s

04:40:01.541 [info] == Running Farmbot.System.ConfigStorage.Migrations.EmailOnEstop.change/0 forward

04:40:01.546 [info] == Migrated in 0.0s

04:40:01.682 [error] backend port not found: :inotifywait

Checking test_tmp/boot

Beginning Bootstrap authorization: stevegraham@hotmail.com - https://my.farmbot.io/

Successful Bootstrap authorization: stevegraham@hotmail.com - https://my.farmbot.io/

Ensuring /tmp/images/ exists.

Firmware is being stubbed.

Syncing all Farmware repos. This may take a while.

First party farmware is disabled.

FBOS is the source of truth; Uploading data.

  1. test emergency locks and unlocks the bot (Farmbot.FirmwareTest)
    test/farmbot/firmware/firmware_test.exs:18
    Expected truthy, got false
    code: assert Farmbot.BotState.locked?()
    stacktrace:
    test/farmbot/firmware/firmware_test.exs:20: (test)

  1. test mutates env (Farmbot.CeleryScript.AST.Node.SetServoAngleTest)
    test/farmbot/celery_script/ast/node/set_servo_angle_test.exs:6
    ** (MatchError) no match of right hand side value: {:error, :firmware_error, %Macro.Env{aliases: [], context: nil, context_modules: [], export_vars: nil, file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/set_servo_angle.ex”, function: {:execute, 3}, functions: [], lexical_tracker: nil, line: 8, macro_aliases: [], macros: [], match_vars: :warn, module: Farmbot.CeleryScript.AST.Node.SetServoAngle, prematch_vars: nil, requires: [], vars: []}}
    code: {:ok, env} = SetServoAngle.execute(%{pin_number: 5, pin_value: 180}, [], env)
    stacktrace:
    test/farmbot/celery_script/ast/node/set_servo_angle_test.exs:7: (test)

  2. test mutates env (Farmbot.CeleryScript.AST.Node.MoveRelativeTest)
    test/farmbot/celery_script/ast/node/move_relative_test.exs:6
    ** (MatchError) no match of right hand side value: {:error, :firmware_error, %Macro.Env{aliases: [], context: nil, context_modules: [], export_vars: nil, file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/move_absolute.ex”, function: {:execute, 3}, functions: [], lexical_tracker: nil, line: 11, macro_aliases: [], macros: [], match_vars: :warn, module: Farmbot.CeleryScript.AST.Node.MoveAbsolute, prematch_vars: nil, requires: [], vars: []}}
    code: {:ok, env} = MoveRelative.execute(%{x: 0, y: 0, z: 0, speed: 100}, [], env)
    stacktrace:
    test/farmbot/celery_script/ast/node/move_relative_test.exs:7: (test)

  3. test moves relatively from a location to another location (Farmbot.CeleryScript.AST.Node.MoveRelativeTest)
    test/farmbot/celery_script/ast/node/move_relative_test.exs:11
    ** (MatchError) no match of right hand side value: {:error, :firmware_error, %Macro.Env{aliases: [], context: nil, context_modules: [], export_vars: nil, file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/move_absolute.ex”, function: {:execute, 3}, functions: [], lexical_tracker: nil, line: 11, macro_aliases: [], macros: [], match_vars: :warn, module: Farmbot.CeleryScript.AST.Node.MoveAbsolute, prematch_vars: nil, requires: [], vars: []}}
    code: {:ok, env} = MoveAbsolute.execute(%{location: coordinate, offset: nothing(), speed: 100}, [], env)
    stacktrace:
    test/farmbot/celery_script/ast/node/move_relative_test.exs:13: (test)

  4. test moves to a location with no offset (Farmbot.CeleryScript.AST.Node.MoveAbsoluteTest)
    test/farmbot/celery_script/ast/node/move_absolute_test.exs:16
    match (match?) failed
    code: assert match?({:ok, %Macro.Env{}}, res)
    right: {:error, :firmware_error,
    %Macro.Env{
    aliases: [],
    context: nil,
    context_modules: [],
    export_vars: nil,
    file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/move_absolute.ex”,
    function: {:execute, 3},
    functions: [],
    lexical_tracker: nil,
    line: 11,
    macro_aliases: [],
    macros: [],
    match_vars: :warn,
    module: Farmbot.CeleryScript.AST.Node.MoveAbsolute,
    prematch_vars: nil,
    requires: [],
    vars: []
    }}
    stacktrace:
    test/farmbot/celery_script/ast/node/move_absolute_test.exs:4: Farmbot.CeleryScript.AST.Node.MoveAbsoluteTest.assert_cs_success/1
    test/farmbot/celery_script/ast/node/move_absolute_test.exs:24: (test)

  5. test mutates env (Farmbot.CeleryScript.AST.Node.MoveAbsoluteTest)
    test/farmbot/celery_script/ast/node/move_absolute_test.exs:6
    ** (MatchError) no match of right hand side value: {:error, :firmware_error, %Macro.Env{aliases: [], context: nil, context_modules: [], export_vars: nil, file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/move_absolute.ex”, function: {:execute, 3}, functions: [], lexical_tracker: nil, line: 11, macro_aliases: [], macros: [], match_vars: :warn, module: Farmbot.CeleryScript.AST.Node.MoveAbsolute, prematch_vars: nil, requires: [], vars: []}}
    code: {:ok, env} = MoveAbsolute.execute(args, [], env)
    stacktrace:
    test/farmbot/celery_script/ast/node/move_absolute_test.exs:12: (test)

  6. test moves to a location with an offset (Farmbot.CeleryScript.AST.Node.MoveAbsoluteTest)
    test/farmbot/celery_script/ast/node/move_absolute_test.exs:31
    match (match?) failed
    code: assert match?({:ok, %Macro.Env{}}, res)
    right: {:error, :firmware_error,
    %Macro.Env{
    aliases: [],
    context: nil,
    context_modules: [],
    export_vars: nil,
    file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/move_absolute.ex”,
    function: {:execute, 3},
    functions: [],
    lexical_tracker: nil,
    line: 11,
    macro_aliases: [],
    macros: [],
    match_vars: :warn,
    module: Farmbot.CeleryScript.AST.Node.MoveAbsolute,
    prematch_vars: nil,
    requires: [],
    vars: []
    }}
    stacktrace:
    test/farmbot/celery_script/ast/node/move_absolute_test.exs:4: Farmbot.CeleryScript.AST.Node.MoveAbsoluteTest.assert_cs_success/1
    test/farmbot/celery_script/ast/node/move_absolute_test.exs:39: (test)

  7. test homes y axis (Farmbot.CeleryScript.AST.Node.HomeTest)
    test/farmbot/celery_script/ast/node/home_test.exs:26
    match (match?) failed
    code: assert match?({:ok, %Macro.Env{}}, res)
    right: {:error, :firmware_error,
    %Macro.Env{
    aliases: [],
    context: nil,
    context_modules: [],
    export_vars: nil,
    file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/home.ex”,
    function: {:execute, 3},
    functions: [],
    lexical_tracker: nil,
    line: 21,
    macro_aliases: [],
    macros: [],
    match_vars: :warn,
    module: Farmbot.CeleryScript.AST.Node.Home,
    prematch_vars: nil,
    requires: [],
    vars: []
    }}
    stacktrace:
    test/farmbot/celery_script/ast/node/home_test.exs:4: Farmbot.CeleryScript.AST.Node.HomeTest.assert_cs_success/1
    test/farmbot/celery_script/ast/node/home_test.exs:27: (test)

  8. test homes x axis (Farmbot.CeleryScript.AST.Node.HomeTest)
    test/farmbot/celery_script/ast/node/home_test.exs:21
    match (match?) failed
    code: assert match?({:ok, %Macro.Env{}}, res)
    right: {:error, :firmware_error,
    %Macro.Env{
    aliases: [],
    context: nil,
    context_modules: [],
    export_vars: nil,
    file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/home.ex”,
    function: {:execute, 3},
    functions: [],
    lexical_tracker: nil,
    line: 21,
    macro_aliases: [],
    macros: [],
    match_vars: :warn,
    module: Farmbot.CeleryScript.AST.Node.Home,
    prematch_vars: nil,
    requires: [],
    vars: []
    }}
    stacktrace:
    test/farmbot/celery_script/ast/node/home_test.exs:4: Farmbot.CeleryScript.AST.Node.HomeTest.assert_cs_success/1
    test/farmbot/celery_script/ast/node/home_test.exs:22: (test)

  9. test homes z axis (Farmbot.CeleryScript.AST.Node.HomeTest)
    test/farmbot/celery_script/ast/node/home_test.exs:31
    match (match?) failed
    code: assert match?({:ok, %Macro.Env{}}, res)
    right: {:error, :firmware_error,
    %Macro.Env{
    aliases: [],
    context: nil,
    context_modules: [],
    export_vars: nil,
    file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/home.ex”,
    function: {:execute, 3},
    functions: [],
    lexical_tracker: nil,
    line: 21,
    macro_aliases: [],
    macros: [],
    match_vars: :warn,
    module: Farmbot.CeleryScript.AST.Node.Home,
    prematch_vars: nil,
    requires: [],
    vars: []
    }}
    stacktrace:
    test/farmbot/celery_script/ast/node/home_test.exs:4: Farmbot.CeleryScript.AST.Node.HomeTest.assert_cs_success/1
    test/farmbot/celery_script/ast/node/home_test.exs:32: (test)

  10. test mutates env (Farmbot.CeleryScript.AST.Node.HomeTest)
    test/farmbot/celery_script/ast/node/home_test.exs:11
    ** (MatchError) no match of right hand side value: {:error, :firmware_error, %Macro.Env{aliases: [], context: nil, context_modules: [], export_vars: nil, file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/home.ex”, function: {:execute, 3}, functions: [], lexical_tracker: nil, line: 8, macro_aliases: [], macros: [], match_vars: :warn, module: Farmbot.CeleryScript.AST.Node.Home, prematch_vars: nil, requires: [], vars: []}}
    code: {:ok, env} = Home.execute(%{axis: :all, speed: 100}, [], env)
    stacktrace:
    test/farmbot/celery_script/ast/node/home_test.exs:12: (test)

  11. test homes all axises (Farmbot.CeleryScript.AST.Node.HomeTest)
    test/farmbot/celery_script/ast/node/home_test.exs:16
    match (match?) failed
    code: assert match?({:ok, %Macro.Env{}}, res)
    right: {:error, :firmware_error,
    %Macro.Env{
    aliases: [],
    context: nil,
    context_modules: [],
    export_vars: nil,
    file: “/home/ubuntu/farmbot_os/lib/farmbot/celery_script/ast/node/home.ex”,
    function: {:execute, 3},
    functions: [],
    lexical_tracker: nil,
    line: 8,
    macro_aliases: [],
    macros: [],
    match_vars: :warn,
    module: Farmbot.CeleryScript.AST.Node.Home,
    prematch_vars: nil,
    requires: [],
    vars: []
    }}
    stacktrace:
    test/farmbot/celery_script/ast/node/home_test.exs:4: Farmbot.CeleryScript.AST.Node.HomeTest.assert_cs_success/1
    test/farmbot/celery_script/ast/node/home_test.exs:17: (test)

Finished in 7.9 seconds
93 tests, 12 failures

Randomized with seed 751300
ubuntu@ip-172-31-30-3:~/farmbot_os$

You are running the integration tests for the firmware.
try mix test --exclude farmbot_firmware

Thanks heaps, that’s sorted it. I thought the firmware was stubbed out to allow for it not really existing. I’ll try to make the compiled one boot my farmbot and, if that works, I’ll make a minor change and see if that works.
I want to end up making my farmbot find its tools by itself knowing that it can move in each direction and take photos and knowing what a tool “looks” like.
Thanks again.

2 Likes