diff --git a/shard.lock b/shard.lock index a6d70b0..ec1f18e 100644 --- a/shard.lock +++ b/shard.lock @@ -7,7 +7,7 @@ shards: action-controller: git: https://github.com/spider-gazelle/action-controller.git - version: 4.10.1 + version: 5.1.8 active-model: git: https://github.com/spider-gazelle/active-model.git @@ -81,6 +81,10 @@ shards: git: https://github.com/luckyframework/habitat.git version: 0.4.7 + hot_topic: + git: https://github.com/jgaskins/hot_topic.git + version: 0.1.0+git.commit.c4577d949221d535f29162343bf503b578308954 + http-params-serializable: git: https://github.com/place-labs/http-params-serializable.git version: 0.5.0 @@ -127,7 +131,7 @@ shards: openssl_ext: git: https://github.com/spider-gazelle/openssl_ext.git - version: 2.1.5 + version: 2.2.0 opentelemetry-api: git: https://github.com/wyhaines/opentelemetry-api.cr.git @@ -135,11 +139,11 @@ shards: opentelemetry-instrumentation: git: https://github.com/wyhaines/opentelemetry-instrumentation.cr.git - version: 0.3.6+git.commit.2b4477f57da6b593469deadc3a439e5ed83dd23f + version: 0.5.0+git.commit.7d83b9a53c9540fbc159f06eeed5d4bdad5c4377 opentelemetry-sdk: # Overridden git: https://github.com/wyhaines/opentelemetry-sdk.cr.git - version: 0.5.0+git.commit.5629aa05bfc0837abe6efd8f19ad28b560d9b6b7 + version: 0.5.1+git.commit.857f4dc24e3c4f2ed04b81118b39beccdecdb105 pars: # Overridden git: https://github.com/spider-gazelle/pars.git @@ -151,11 +155,11 @@ shards: placeos-log-backend: git: https://github.com/place-labs/log-backend.git - version: 0.11.1 + version: 0.11.2 placeos-models: git: https://github.com/placeos/models.git - version: 8.11.0 + version: 8.11.2 protobuf: git: https://github.com/jeromegn/protobuf.cr.git diff --git a/shard.yml b/shard.yml index 0f85764..46e50c7 100644 --- a/shard.yml +++ b/shard.yml @@ -13,7 +13,7 @@ targets: dependencies: action-controller: github: spider-gazelle/action-controller - version: ~> 4.4 + version: ~> 5.1 awscr-s3: github: taylorfinnell/awscr-s3 diff --git a/spec/helper.cr b/spec/helper.cr index 34b067a..f245782 100644 --- a/spec/helper.cr +++ b/spec/helper.cr @@ -2,8 +2,8 @@ require "placeos-log-backend" require "spec" require "webmock" -# Helper methods for testing controllers (curl, with_server, context) -require "../lib/action-controller/spec/curl_context" +# Helper methods for testing controllers +require "action-controller/spec_helper" Spec.before_suite do WebMock.allow_net_connect = true diff --git a/spec/placeos-build/api/driver_spec.cr b/spec/placeos-build/api/driver_spec.cr index 588c781..0ac045f 100644 --- a/spec/placeos-build/api/driver_spec.cr +++ b/spec/placeos-build/api/driver_spec.cr @@ -5,23 +5,23 @@ module PlaceOS::Build describe Api::Driver do broken_repository_path = "spec/repository_fixtures/broken" broken_entrypoint = "drivers/place/broken.cr" - with_server do - describe "POST ../:file" do - it "gracefully handles malformed driver" do - tempdir = Dir.tempdir - temporary_repository = File.join(tempdir, Path[broken_repository_path].basename) - FileUtils.cp_r(broken_repository_path, tempdir) - Build.support_local_builds = true - Client.client(URI.parse("http://localhost:6000")) do |client| - client.repository_path = temporary_repository - client.compile( - file: broken_entrypoint, - url: "local", - commit: "abcde", - ) do - # This should not be called - true.should be_false - end + + describe "POST ../:file" do + it "gracefully handles malformed driver" do + tempdir = Dir.tempdir + temporary_repository = File.join(tempdir, Path[broken_repository_path].basename) + FileUtils.cp_r(broken_repository_path, tempdir) + Build.support_local_builds = true + + Client.client(URI.parse("http://localhost:6000"), connection: ActionController::SpecHelper.client) do |client| + client.repository_path = temporary_repository + client.compile( + file: broken_entrypoint, + url: "local", + commit: "abcde", + ) do + # This should not be called + true.should be_false end end end diff --git a/src/placeos-build/client.cr b/src/placeos-build/client.cr index c7ff5a7..e285f0c 100644 --- a/src/placeos-build/client.cr +++ b/src/placeos-build/client.cr @@ -42,8 +42,8 @@ module PlaceOS::Build end # :ditto: - def self.client(uri : URI, build_version : String = BUILD_VERSION) - client = new(uri, build_version) + def self.client(uri : URI, build_version : String = BUILD_VERSION, connection : HTTP::Client? = nil) + client = new(uri, build_version, connection) begin yield client ensure @@ -51,11 +51,12 @@ module PlaceOS::Build end end - def initialize(uri : URI, @build_version : String = BUILD_VERSION) + def initialize(uri : URI, @build_version : String = BUILD_VERSION, connection : HTTP::Client? = nil) uri_host = uri.host.presence || raise ArgumentError.new("Could not parse host from URI") uri_port = uri.port @host = uri_host @port = uri_port if uri_port + @connection = connection unless connection.nil? end def initialize(host : String? = nil, port : Int32? = nil, @build_version : String = BUILD_VERSION)