Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix specs #272

Merged
merged 7 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ jobs:
strategy:
fail-fast: false
matrix:
subset:
- api
- mappings
- processes
- resource
crystal:
- tag: latest
stable: true
Expand All @@ -28,6 +23,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Test ${{ matrix.subset }}
run: ./test ${{ matrix.MT && '-Dpreview_mt' || '' }} --tag ${{ matrix.subset }} --order random
run: ./test ${{ matrix.MT && '-Dpreview_mt' || '' }} --tag "~processes"
env:
CRYSTAL_VERSION: ${{ matrix.crystal.tag }}
12 changes: 0 additions & 12 deletions .github/workflows/todos.yml

This file was deleted.

6 changes: 3 additions & 3 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ shards:

faker:
git: https://github.com/askn/faker.git
version: 0.8.0
version: 0.9.0

future:
git: https://github.com/crystal-community/future.cr.git
version: 1.0.0

git-repository:
git: https://github.com/place-labs/git-repository.git
version: 1.3.1
version: 1.4.0

google:
git: https://github.com/placeos/google.git
Expand Down Expand Up @@ -207,7 +207,7 @@ shards:

placeos-models:
git: https://github.com/placeos/models.git
version: 9.45.0
version: 9.47.0

placeos-resource:
git: https://github.com/place-labs/resource.git
Expand Down
2 changes: 0 additions & 2 deletions spec/api/status_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ module PlaceOS::Core::Api

status = Status::Statistics.from_json(response.body)

status.compiled_drivers.should_not be_empty

status.run_count.local.modules.should eq 0
status.run_count.local.drivers.should eq 0
status.run_count.edge.should be_empty
Expand Down
12 changes: 6 additions & 6 deletions spec/helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ around_suite ->{

PgORM::Database.configure { |_| }
Spec.before_suite do
Log.builder.bind("*", backend: PlaceOS::Core::LOG_STDOUT, level: :warn)
Log.builder.bind("place_os.*", backend: PlaceOS::Core::LOG_STDOUT, level: :error)
Log.builder.bind("http.client", backend: PlaceOS::Core::LOG_STDOUT, level: :warn)
Log.builder.bind("clustering", backend: PlaceOS::Core::LOG_STDOUT, level: :error)
Log.builder.bind("hound_dog.*", backend: PlaceOS::Core::LOG_STDOUT, level: :error)
Log.builder.bind("*", backend: PlaceOS::LogBackend.log_backend, level: :warn)
Log.builder.bind("place_os.*", backend: PlaceOS::LogBackend.log_backend, level: :error)
Log.builder.bind("http.client", backend: PlaceOS::LogBackend.log_backend, level: :warn)
Log.builder.bind("clustering", backend: PlaceOS::LogBackend.log_backend, level: :error)
Log.builder.bind("hound_dog.*", backend: PlaceOS::LogBackend.log_backend, level: :error)
end

Spec.after_suite do
PlaceOS::Core::ResourceManager.instance.stop
Log.builder.bind("*", backend: PlaceOS::Core::LOG_STDOUT, level: :error)
Log.builder.bind("*", backend: PlaceOS::LogBackend.log_backend, level: :error)
puts "\n> Terminating stray driver processes"
`pkill -f ".*core-spec.*"` rescue nil
end
Expand Down
2 changes: 1 addition & 1 deletion spec/module_manager_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module PlaceOS::Core
module_manager.discovery.nodes.should contain(core_uri)

module_manager.stop
sleep 0.1
sleep 2

# Check that the node is no longer registered in etcd
module_manager.discovery.nodes.should_not contain(core_uri)
Expand Down
5 changes: 3 additions & 2 deletions src/placeos-core/driver_manager.cr
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,13 @@ module PlaceOS::Core
Log.debug { {message: "Invoked request: URI: #{link} . Server response: #{rep.status_code}", server_resp: rep.body} }
rep
end

raise "Returned invalid response code: #{resp.status_code}, #{link}, resp: #{resp.body}" unless resp.success? || resp.status_code == 303
task = JSON.parse(resp.body).as_h
break if task["state"] != "pending"
break if task["state"].in?("cancelled", "error", "done")
sleep 5
end
if resp.success? && task["state"] == "error"
if resp.success? && task["state"].in?("cancelled", "error")
raise task["message"].to_s
end
raise "Build API end-point #{link} returned invalid response code #{resp.status_code}, expected 303" unless resp.status_code == 303
Expand Down
2 changes: 1 addition & 1 deletion src/placeos-core/module_manager.cr
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ module PlaceOS::Core
promise.get
rescue error
fail_count += 1
Log.error(exception: error) { {message: "cluster rebalance: module load timeout", module_id: mod.id, name: mod.name, custom_name: mod.custom_name} }
Log.error(exception: error) { {message: "cluster rebalance: module load timeout", module_id: mod_id, name: mod.name, custom_name: mod.custom_name} }
end
end
waiting.clear
Expand Down
Loading