forked from nephio-project/porch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add additional info to error when blockOwnerDeletion is not false,
introduce many new fake types for future mocking
- Loading branch information
1 parent
f9ed20a
commit de9d79c
Showing
18 changed files
with
260 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package fake | ||
|
||
import ( | ||
"context" | ||
|
||
configapi "github.com/nephio-project/porch/api/porchconfig/v1alpha1" | ||
"github.com/nephio-project/porch/pkg/cache" | ||
"github.com/nephio-project/porch/pkg/repository" | ||
"github.com/nephio-project/porch/pkg/repository/fake" | ||
) | ||
|
||
type FakeCache struct{} | ||
|
||
var _ cache.Cache = &FakeCache{} | ||
|
||
func (m *FakeCache) OpenRepository(context.Context, *configapi.Repository) (repository.Repository, error) { | ||
return &fake.FakeRepository{}, nil | ||
} | ||
|
||
func (m *FakeCache) CloseRepository(context.Context, *configapi.Repository, []configapi.Repository) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package fake | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/nephio-project/porch/pkg/engine/utils" | ||
"github.com/nephio-project/porch/pkg/repository" | ||
"k8s.io/apimachinery/pkg/watch" | ||
) | ||
|
||
type FakeWatcherManager struct{} | ||
|
||
var _ utils.WatcherManager = &FakeWatcherManager{} | ||
|
||
func (m *FakeWatcherManager) WatchPackageRevisions(context.Context, repository.ListPackageRevisionFilter, utils.ObjectWatcher) error { | ||
return nil | ||
} | ||
|
||
func (m *FakeWatcherManager) NotifyPackageRevisionChange(watch.EventType, repository.PackageRevision) int { | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package fake | ||
|
||
import ( | ||
"context" | ||
|
||
configapi "github.com/nephio-project/porch/api/porchconfig/v1alpha1" | ||
"github.com/nephio-project/porch/pkg/meta" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
) | ||
|
||
type NoopMetadataStore struct { | ||
Metas []metav1.ObjectMeta | ||
} | ||
|
||
var _ meta.MetadataStore = &NoopMetadataStore{} | ||
|
||
func (ms *NoopMetadataStore) Get(ctx context.Context, namespacedName types.NamespacedName) (metav1.ObjectMeta, error) { | ||
return metav1.ObjectMeta{Name: namespacedName.Name, Namespace: namespacedName.Namespace}, nil | ||
} | ||
|
||
func (ms *NoopMetadataStore) List(context.Context, *configapi.Repository) ([]metav1.ObjectMeta, error) { | ||
return ms.Metas, nil | ||
} | ||
|
||
func (ms *NoopMetadataStore) Create(ctx context.Context, pkgRevMeta metav1.ObjectMeta, repoName string, pkgRevUID types.UID) (metav1.ObjectMeta, error) { | ||
return pkgRevMeta, nil | ||
} | ||
|
||
func (ms *NoopMetadataStore) Update(ctx context.Context, pkgRevMeta metav1.ObjectMeta) (metav1.ObjectMeta, error) { | ||
return pkgRevMeta, nil | ||
} | ||
|
||
func (ms *NoopMetadataStore) Delete(ctx context.Context, namespacedName types.NamespacedName, clearFinalizer bool) (metav1.ObjectMeta, error) { | ||
return metav1.ObjectMeta{Name: namespacedName.Name, Namespace: namespacedName.Namespace}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package fake | ||
|
||
import ( | ||
"github.com/nephio-project/porch/api/porch/v1alpha1" | ||
"github.com/nephio-project/porch/pkg/repository" | ||
) | ||
|
||
type FakePackage struct { | ||
Name string | ||
PackageKey repository.PackageKey | ||
LatestRevision string | ||
} | ||
|
||
var _ repository.Package = &FakePackage{} | ||
|
||
func (pkg *FakePackage) KubeObjectName() string { | ||
return pkg.Name | ||
} | ||
|
||
func (pkg *FakePackage) Key() repository.PackageKey { | ||
return pkg.PackageKey | ||
} | ||
|
||
func (pkg *FakePackage) GetPackage() *v1alpha1.PorchPackage { | ||
panic("not implemented") | ||
} | ||
|
||
func (pkg *FakePackage) GetLatestRevision() string { | ||
return pkg.LatestRevision | ||
} |
Oops, something went wrong.