-
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.
- Loading branch information
Showing
24 changed files
with
771 additions
and
103 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
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 |
---|---|---|
|
@@ -62,6 +62,10 @@ vet: ## Run go vet against code. | |
test: manifests generate fmt vet envtest ## Run tests. | ||
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out | ||
|
||
.PHONY: lint | ||
lint: golangci-lint ## Run golangci-lint against code. | ||
$(GOLANGCI_LINT) run --fix | ||
|
||
##@ Build | ||
|
||
.PHONY: build | ||
|
@@ -105,6 +109,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified | |
.PHONY: deploy | ||
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. | ||
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} | ||
cd config/default && $(KUSTOMIZE) edit set label "app.kubernetes.io/version:${VERSION}" | ||
$(KUSTOMIZE) build config/default | kubectl apply -f - | ||
|
||
.PHONY: undeploy | ||
|
@@ -123,6 +128,7 @@ KUSTOMIZE ?= $(LOCALBIN)/kustomize | |
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen | ||
ENVTEST ?= $(LOCALBIN)/setup-envtest | ||
IFACEMAKER ?= $(LOCALBIN)/ifacemaker | ||
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint | ||
|
||
## Tool Versions | ||
KUSTOMIZE_VERSION ?= v4.5.5 | ||
|
@@ -147,4 +153,8 @@ $(ENVTEST): $(LOCALBIN) | |
.PHONY: ifacemaker | ||
ifacemaker: $(IFACEMAKER) ## Download ifacemaker locally if necessary. | ||
$(IFACEMAKER): $(LOCALBIN) | ||
test -s $(LOCALBIN)/ifacemaker || GOBIN=$(LOCALBIN) go install github.com/vburenin/ifacemaker@latest | ||
test -s $(LOCALBIN)/ifacemaker || GOBIN=$(LOCALBIN) go install github.com/vburenin/ifacemaker@latest | ||
|
||
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary. | ||
$(GOLANGCI_LINT): $(LOCALBIN) | ||
test -s $(LOCALBIN)/golangci-lint || GOBIN=$(LOCALBIN) go install github.com/golangci/golangci-lint/cmd/[email protected] |
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,62 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func TestFeed_AuthSecretRef(t *testing.T) { | ||
type fields struct { | ||
TypeMeta v1.TypeMeta | ||
ObjectMeta v1.ObjectMeta | ||
Spec FeedSpec | ||
Status FeedStatus | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
want AuthSecretReference | ||
}{ | ||
{ | ||
name: "expected", | ||
fields: fields{ | ||
TypeMeta: v1.TypeMeta{}, | ||
ObjectMeta: v1.ObjectMeta{}, | ||
Spec: FeedSpec{ | ||
Title: "", | ||
RssSourceURL: "", | ||
ParentDirID: nil, | ||
DeleteOldFiles: false, | ||
DontProcessWholeFeed: false, | ||
Keyword: "", | ||
UnwantedKeywords: "", | ||
Paused: false, | ||
AuthSecretRef: AuthSecretReference{ | ||
Name: "foo", | ||
Key: "bar", | ||
}, | ||
}, | ||
Status: FeedStatus{}, | ||
}, | ||
want: AuthSecretReference{ | ||
Name: "foo", | ||
Key: "bar", | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
in := &Feed{ | ||
TypeMeta: tt.fields.TypeMeta, | ||
ObjectMeta: tt.fields.ObjectMeta, | ||
Spec: tt.fields.Spec, | ||
Status: tt.fields.Status, | ||
} | ||
if got := in.AuthSecretRef(); !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("AuthSecretRef() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
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
Oops, something went wrong.