mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
getmodules: NewPackageFetcher now expects an "environment" argument
This continues our work to follow the dependency inversion style for the "package fetcher" component of the module installer. Mimicking the existing pattern for providers, package main is now responsible for instantiating the PackageFetcher and providing it to the "command" package as a field of command.Meta. We could potentially go further here and follow dependency inversion style for _all_ of the special clients needed by the various go-getter getters, but our primary concern for now is preparing to add a new "getter" for installation from an OCI Distribution repository, and so we'll leave the other already-working code unchanged to reduce the risk of this initial work. Future commits will actually wire in the implementation details for OCI Repository access. This commit focuses only on plumbing the necessary objects through the API layers. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
@@ -10,6 +10,8 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/mitchellh/cli"
|
||||
|
||||
"github.com/opentofu/opentofu/internal/getmodules"
|
||||
)
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
@@ -103,6 +105,14 @@ func TestGet_cancel(t *testing.T) {
|
||||
Ui: ui,
|
||||
WorkingDir: wd,
|
||||
ShutdownCh: shutdownCh,
|
||||
|
||||
// This test needs a real module package fetcher instance because
|
||||
// its configuration includes a reference to a module from a registry
|
||||
// that doesn't really exist. The shutdown signal prevents us from
|
||||
// actually making a request to this, but we still need to provide
|
||||
// the fetcher so that it will _attempt_ to make a network request
|
||||
// that can then fail with a cancellation error.
|
||||
ModulePackageFetcher: getmodules.NewPackageFetcher(nil),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user