-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
e9f7faa
commit 5b85a14
Showing
45 changed files
with
7,222 additions
and
160 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
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,35 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1beta1 contains API Schema definitions for the lagoon v1beta1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=crd.lagoon.sh | ||
package v1beta2 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "crd.lagoon.sh", Version: "v1beta2"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
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,105 @@ | ||
package v1beta2 | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestCheckLagoonVersion(t *testing.T) { | ||
type args struct { | ||
build *LagoonBuild | ||
checkVersion string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want bool | ||
}{ | ||
{ | ||
name: "test1", | ||
args: args{ | ||
build: &LagoonBuild{ | ||
Spec: LagoonBuildSpec{ | ||
Project: Project{ | ||
Variables: LagoonVariables{ | ||
Project: []byte(`[{"name":"LAGOON_SYSTEM_CORE_VERSION","value":"v2.12.0","scope":"internal_system"}]`), | ||
}, | ||
}, | ||
}, | ||
}, | ||
checkVersion: "2.12.0", | ||
}, | ||
want: true, | ||
}, | ||
{ | ||
name: "test2", | ||
args: args{ | ||
build: &LagoonBuild{ | ||
Spec: LagoonBuildSpec{ | ||
Project: Project{ | ||
Variables: LagoonVariables{ | ||
Project: []byte(`[{"name":"LAGOON_SYSTEM_CORE_VERSION","value":"v2.11.0","scope":"internal_system"}]`), | ||
}, | ||
}, | ||
}, | ||
}, | ||
checkVersion: "2.12.0", | ||
}, | ||
want: false, | ||
}, | ||
{ | ||
name: "test3", | ||
args: args{ | ||
build: &LagoonBuild{ | ||
Spec: LagoonBuildSpec{ | ||
Project: Project{ | ||
Variables: LagoonVariables{ | ||
Project: []byte(`[]`), | ||
}, | ||
}, | ||
}, | ||
}, | ||
checkVersion: "2.12.0", | ||
}, | ||
want: false, | ||
}, | ||
{ | ||
name: "test4", | ||
args: args{ | ||
build: &LagoonBuild{ | ||
Spec: LagoonBuildSpec{ | ||
Project: Project{ | ||
Variables: LagoonVariables{ | ||
Project: []byte(`[{"name":"LAGOON_SYSTEM_CORE_VERSION","value":"v2.12.0","scope":"internal_system"}]`), | ||
}, | ||
}, | ||
}, | ||
}, | ||
checkVersion: "v2.12.0", | ||
}, | ||
want: true, | ||
}, | ||
{ | ||
name: "test5", | ||
args: args{ | ||
build: &LagoonBuild{ | ||
Spec: LagoonBuildSpec{ | ||
Project: Project{ | ||
Variables: LagoonVariables{ | ||
Project: []byte(`[{"name":"LAGOON_SYSTEM_CORE_VERSION","value":"v2.11.0","scope":"internal_system"}]`), | ||
}, | ||
}, | ||
}, | ||
}, | ||
checkVersion: "v2.12.0", | ||
}, | ||
want: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := CheckLagoonVersion(tt.args.build, tt.args.checkVersion); got != tt.want { | ||
t.Errorf("CheckLagoonVersion() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.