Skip to content

Commit

Permalink
use constant in tests too
Browse files Browse the repository at this point in the history
Signed-off-by: Somtochi Onyekwere <[email protected]>
  • Loading branch information
somtochiama committed Oct 19, 2023
1 parent e052adb commit 5b9d5ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions cmd/flux/cluster_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ var bootstrapLabels = []string{

// fluxClusterInfo contains information about an existing flux installation on a cluster.
type fluxClusterInfo struct {
// bootstrapped indicates if flux was installed using the `flux bootstrap` command.
// bootstrapped indicates that Flux was installed using the `flux bootstrap` command.
bootstrapped bool
// managedBy is the manager of the installation
// managedBy is the name of the manager who installed Flux.
managedBy string
// version is the flux version of the installation.
// version is the Flux version number in semver format.
version string
}

Expand Down
16 changes: 9 additions & 7 deletions cmd/flux/cluster_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package main

import (
"context"
"fmt"
kustomizev1 "github.com/fluxcd/kustomize-controller/api/v1"
"os"
"testing"

Expand Down Expand Up @@ -52,9 +54,9 @@ func Test_getFluxClusterInfo(t *testing.T) {
{
name: "CRD with kustomize-controller labels",
labels: map[string]string{
"kustomize.toolkit.fluxcd.io/name": "flux-system",
"kustomize.toolkit.fluxcd.io/namespace": "flux-system",
"app.kubernetes.io/version": "v2.1.0",
fmt.Sprintf("%s/name", kustomizev1.GroupVersion.Group): "flux-system",
fmt.Sprintf("%s/namespace", kustomizev1.GroupVersion.Group): "flux-system",
"app.kubernetes.io/version": "v2.1.0",
},
wantBool: true,
wantInfo: fluxClusterInfo{
Expand All @@ -65,10 +67,10 @@ func Test_getFluxClusterInfo(t *testing.T) {
{
name: "CRD with kustomize-controller labels and managed-by label",
labels: map[string]string{
"kustomize.toolkit.fluxcd.io/name": "flux-system",
"kustomize.toolkit.fluxcd.io/namespace": "flux-system",
"app.kubernetes.io/version": "v2.1.0",
"app.kubernetes.io/managed-by": "flux",
fmt.Sprintf("%s/name", kustomizev1.GroupVersion.Group): "flux-system",
fmt.Sprintf("%s/namespace", kustomizev1.GroupVersion.Group): "flux-system",
"app.kubernetes.io/version": "v2.1.0",
"app.kubernetes.io/managed-by": "flux",
},
wantBool: true,
wantInfo: fluxClusterInfo{
Expand Down

0 comments on commit 5b9d5ae

Please sign in to comment.