-
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.
refactor: move v1beta1 related functions into their own api or contro…
…llers for easier isolation
- Loading branch information
1 parent
0e99812
commit e9f7faa
Showing
31 changed files
with
1,028 additions
and
1,290 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package v1beta1 | ||
|
||
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.