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

refactor: PPT-1678 refactored to work with latest dependencies #32

Merged
merged 1 commit into from
Dec 18, 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
4 changes: 4 additions & 0 deletions .ameba.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Naming/BlockParameterName:
Description: Disallows non-descriptive block parameter names
Enabled: false
Severity: Convention
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ services:
environment:
PLACEOS_BUILD_LOCAL: "true"
PLACEOS_ENABLE_TRACE: "true"
BUILD_SERVICE_DISABLED: "true"

redis:
image: eqalpha/keydb
Expand Down
88 changes: 40 additions & 48 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ shards:

action-controller:
git: https://github.com/spider-gazelle/action-controller.git
version: 4.10.1
version: 7.5.1

active-model:
git: https://github.com/spider-gazelle/active-model.git
version: 4.3.2

ameba:
git: https://github.com/crystal-ameba/ameba.git
version: 1.6.1
version: 1.6.4

ansi-escapes:
git: https://github.com/gtramontina/ansi-escapes.cr.git
Expand All @@ -39,15 +39,15 @@ shards:

bindata:
git: https://github.com/spider-gazelle/bindata.git
version: 2.0.0
version: 2.1.0

clip:
git: https://github.com/erdnaxeli/clip.git
version: 0.2.4

connect-proxy:
git: https://github.com/spider-gazelle/connect-proxy.git
version: 2.0.0
version: 2.0.2

crc16:
git: https://github.com/maiha/crc16.cr.git
Expand All @@ -63,15 +63,15 @@ shards:

csuuid:
git: https://github.com/wyhaines/csuuid.cr.git
version: 1.0.0+git.commit.a4cf9615c6518cf27c68a1755a8c2ac4ae4fe987
version: 1.0.2

db:
git: https://github.com/crystal-lang/crystal-db.git
version: 0.13.1

debug:
git: https://github.com/sija/debug.cr.git
version: 2.0.2
version: 2.0.4

defined:
git: https://github.com/wyhaines/defined.cr.git
Expand All @@ -83,19 +83,15 @@ shards:

email:
git: https://github.com/arcage/crystal-email.git
version: 0.7.0

etcd:
git: https://github.com/place-labs/crystal-etcd.git
version: 1.2.5
version: 0.7.1

eventbus:
git: https://github.com/spider-gazelle/eventbus.git
version: 0.9.9+git.commit.ca8ef0c5e21ee15da079edd5bcea39bee7e07f26
version: 1.0.0+git.commit.af63536d718348885a553dc4aa6debccc2946289

exception_page:
git: https://github.com/crystal-loot/exception_page.git
version: 0.4.1
version: 0.5.0

exec_from:
git: https://github.com/place-labs/exec_from.git
Expand All @@ -107,7 +103,7 @@ shards:

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

google:
git: https://github.com/placeos/google.git
Expand All @@ -119,11 +115,11 @@ shards:

habitat:
git: https://github.com/luckyframework/habitat.git
version: 0.4.8
version: 0.4.9

hound-dog:
git: https://github.com/place-labs/hound-dog.git
version: 2.9.1
hot_topic:
git: https://github.com/jgaskins/hot_topic.git
version: 0.1.0+git.commit.3c901e77b6e000930398738260a2944b6f5785dc

http-params-serializable:
git: https://github.com/place-labs/http-params-serializable.git
Expand Down Expand Up @@ -151,7 +147,7 @@ shards:

lucky_router:
git: https://github.com/luckyframework/lucky_router.git
version: 0.5.2
version: 0.6.0

lz4:
git: https://github.com/naqvis/lz4.cr.git
Expand All @@ -167,39 +163,31 @@ shards:

nbchannel:
git: https://github.com/wyhaines/nbchannel.cr.git
version: 0.1.0+git.commit.a8f5be6aa198abfa9f1893e1156640b8ea526094
version: 0.1.0

neuroplastic:
git: https://github.com/spider-gazelle/neuroplastic.git
version: 1.13.0
version: 1.13.1

office365:
git: https://github.com/placeos/office365.git
version: 1.23.3

open_api:
git: https://github.com/elbywan/open_api.cr.git
version: 1.3.0

openapi-generator:
git: https://github.com/place-labs/openapi-generator.git
version: 2.1.0+git.commit.a65ffc2f7dcc6a393e7d1f9229650b520d9525be
version: 1.25.4

openssl_ext:
git: https://github.com/spider-gazelle/openssl_ext.git
version: 2.4.4

opentelemetry-api:
git: https://github.com/wyhaines/opentelemetry-api.cr.git
version: 0.5.0
version: 0.5.1

opentelemetry-instrumentation:
git: https://github.com/wyhaines/opentelemetry-instrumentation.cr.git
version: 0.5.3+git.commit.cd3994b22d9f7a0d68752698974d3873a1b2fce2
version: 0.5.5+git.commit.83eace832dad20a71231e71a42258538b05fb193

opentelemetry-sdk:
git: https://github.com/wyhaines/opentelemetry-sdk.cr.git
version: 0.6.1
version: 0.6.2

pars: # Overridden
git: https://github.com/spider-gazelle/pars.git
Expand All @@ -215,59 +203,59 @@ shards:

pg:
git: https://github.com/will/crystal-pg.git
version: 0.28.0
version: 0.29.0

pg-orm:
git: https://github.com/spider-gazelle/pg-orm.git
version: 1.1.0+git.commit.e35e4c535be1ab47b6afb821723ceafb637fa4e8
version: 1.1.2+git.commit.9b340ee269cd4a10ed6c5b51235cbaf45fc380e1

pinger:
git: https://github.com/spider-gazelle/pinger.git
version: 1.1.2

place_calendar:
git: https://github.com/placeos/calendar.git
version: 4.20.1
version: 4.22.1

placeos-build:
git: https://github.com/placeos/build.git
version: 1.3.0
version: 1.5.1

placeos-compiler:
git: https://github.com/placeos/compiler.git
version: 4.9.3
version: 4.9.4

placeos-core-client:
git: https://github.com/placeos/core-client.git
version: 0.5.2

placeos-driver:
git: https://github.com/placeos/driver.git
version: 6.9.18
version: 7.3.0

placeos-log-backend:
git: https://github.com/place-labs/log-backend.git
version: 0.11.0

placeos-models:
git: https://github.com/placeos/models.git
version: 9.37.0
version: 9.60.1

pool:
git: https://github.com/ysbaddaden/pool.git
version: 0.2.4

promise:
git: https://github.com/spider-gazelle/promise.git
version: 3.0.0
version: 3.2.0

protobuf:
git: https://github.com/jeromegn/protobuf.cr.git
version: 2.3.0
version: 2.3.1

raven:
git: https://github.com/sija/raven.cr.git
version: 1.9.3+git.commit.990a7650fb027cbe65705fc6dad228cddc76c503
version: 1.9.4+git.commit.a43f45229d1ee8030f8f07b101cb159896273195

redis:
git: https://github.com/stefanwille/crystal-redis.git
Expand All @@ -277,6 +265,10 @@ shards:
git: https://github.com/caspiano/redis-cluster.cr.git
version: 0.8.5

redis_service_manager:
git: https://github.com/place-labs/redis_service_manager.git
version: 3.2.0

rendezvous-hash:
git: https://github.com/caspiano/rendezvous-hash.git
version: 0.3.1
Expand All @@ -299,35 +291,35 @@ shards:

shards:
git: https://github.com/crystal-lang/shards.git
version: 0.17.4
version: 0.18.0

simple_retry:
git: https://github.com/spider-gazelle/simple_retry.git
version: 1.1.1

splay_tree_map:
git: https://github.com/wyhaines/splay_tree_map.cr.git
version: 0.2.2
version: 0.3.0

ssh2:
git: https://github.com/spider-gazelle/ssh2.cr.git
version: 1.6.1
version: 1.7.0

tasker:
git: https://github.com/spider-gazelle/tasker.git
version: 2.1.4

time-ext:
git: https://github.com/wyhaines/time-ext.cr.git
version: 0.1.0+git.commit.175f658235fb6cdc9c804cb96da510fec27f4cd6
version: 1.0.1

tokenizer:
git: https://github.com/spider-gazelle/tokenizer.git
version: 1.1.1

tracer:
git: https://github.com/wyhaines/tracer.cr.git
version: 0.3.1
version: 0.3.2

ulid: # Overridden
git: https://github.com/place-labs/ulid.git
Expand Down
31 changes: 16 additions & 15 deletions spec/build_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,33 @@ module PlaceOS::Drivers::Api
describe Build do
describe "GET /build" do
it "should list drivers" do
context = Api::Build.with_request("GET", "/build?repository=private_drivers", &.index)

drivers = Array(String).from_json(context.response.output.to_s)
resp = client.get(Build.base_route + "?repository=private_drivers")
drivers = Array(String).from_json(resp.body)
drivers.should_not be_empty
drivers.should contain("drivers/place/private_helper.cr")
end
end

describe "POST /build" do
it "should build a driver" do
Api::Build
.with_request("POST", "/build?commit=#{DRIVER_COMMIT}&repository=private_drivers&driver=drivers/place/private_helper.cr", &.create)
.response
.status_code.should eq(201)
params = HTTP::Params.encode({"commit" => DRIVER_COMMIT, "repository" => "private_drivers", "driver" => "drivers/place/private_helper.cr"})
resp = client.post(Build.base_route + "?#{params}")
resp.status_code.should eq(201)
end
end

describe "GET /build/driver/:driver" do
it "should list compiled versions" do
Api::Build
.with_request("POST", "/build?commit=#{DRIVER_COMMIT}&repository=private_drivers&driver=src/place/private_helper.cr", &.create)
.response.status
params = HTTP::Params.encode({"commit" => DRIVER_COMMIT, "repository" => "private_drivers", "driver" => "drivers/place/private_helper.cr"})
resp = client.post(Build.base_route + "?#{params}")
resp.status
.success?
.should be_true

context = Api::Build.with_request("GET", "/build/src%2Fplace%2Fprivate_helper.cr", route_params: {"driver" => "src/place/private_helper.cr"}, &.show)

params = HTTP::Params.encode({"driver" => "drivers/place/private_helper.cr"})
resp = client.get(Build.base_route + "/#{params}")
Array(PlaceOS::Model::Executable)
.from_json(context.response.output.to_s)
.from_json(resp.body)
.tap(&.should_not be_empty)
.first
.filename
Expand All @@ -42,8 +40,11 @@ module PlaceOS::Drivers::Api

describe "GET /build/driver/:driver/commits" do
it "should list commits" do
context = Api::Build.with_request("GET", "/build/src%2Fplace%2Fprivate_helper.cr/commits?repository=private_drivers", route_params: {"driver" => "src/place/private_helper.cr"}, &.commits)
Array(PlaceOS::Compiler::Git::Commit).from_json(context.response.output.to_s).should_not be_empty
resp = client.get(Build.base_route + "/src%2Fplace%2Fprivate_helper.cr/commits?repository=private_drivers")
resp.status
.success?
.should be_true
Array(PlaceOS::Compiler::Git::Commit).from_json(resp.body).should_not be_empty
end
end
end
Expand Down
7 changes: 3 additions & 4 deletions spec/compiler_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ module PlaceOS::Drivers
PlaceOS::Compiler.clone_and_install("private_drivers", "https://github.com/placeos/private-drivers.git")
File.file?(File.expand_path("./repositories/private_drivers/drivers/place/private_helper.cr")).should be_true

Api::Build
.with_request("POST", "/build?repository=private_drivers&driver=drivers/place/private_helper.cr", &.create)
.response
.status_code.should eq(201)
params = HTTP::Params.encode({"repository" => "private_drivers", "driver" => "drivers/place/private_helper.cr"})
resp = client.post(Api::Build.base_route + "?#{params}")
resp.status_code.should eq(201)
end
end
end
Expand Down
Loading