2024-02-08 03:48:59 -06:00
|
|
|
// Copyright (c) The OpenTofu Authors
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
2023-05-02 10:33:06 -05:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2021-10-18 15:54:31 -05:00
|
|
|
package getproviders
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2023-09-20 06:35:35 -05:00
|
|
|
"github.com/opentofu/opentofu/internal/addrs"
|
2021-10-18 15:54:31 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// HangingSource is an implementation of Source which hangs until the given
|
|
|
|
// context is cancelled. This is useful only for unit tests of user-controlled
|
|
|
|
// cancels.
|
|
|
|
type HangingSource struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ Source = (*HangingSource)(nil)
|
|
|
|
|
|
|
|
func (s *HangingSource) AvailableVersions(ctx context.Context, provider addrs.Provider) (VersionList, Warnings, error) {
|
|
|
|
<-ctx.Done()
|
|
|
|
return nil, nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *HangingSource) PackageMeta(ctx context.Context, provider addrs.Provider, version Version, target Platform) (PackageMeta, error) {
|
|
|
|
<-ctx.Done()
|
|
|
|
return PackageMeta{}, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *HangingSource) ForDisplay(provider addrs.Provider) string {
|
|
|
|
return "hanging source"
|
|
|
|
}
|