New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug 1779933: set version to start for s390/ppc until we have actual samples #205
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package stub | |
import ( | ||
"fmt" | ||
"os" | ||
"runtime" | ||
"strings" | ||
"time" | ||
|
||
|
@@ -83,9 +84,17 @@ func TestWithDist(t *testing.T) { | |
func TestWithArchDist(t *testing.T) { | ||
h, cfg, event := setup() | ||
processCred(&h, cfg, t) | ||
cfg.Spec.Architectures = []string{ | ||
v1.X86Architecture, | ||
if len(cfg.Spec.Architectures) == 0 { | ||
t.Errorf("arch not set on bootstrap") | ||
} | ||
testValue := runtime.GOARCH | ||
if testValue == v1.AMDArchitecture { | ||
testValue = v1.X86Architecture | ||
} | ||
if cfg.Spec.Architectures[0] != testValue { | ||
t.Errorf("arch set to %s instead of %s", cfg.Spec.Architectures[0], runtime.GOARCH) | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't look like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the setting of the version happens after the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need it everwhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nevermind ... I'll do it everywhere There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unit test updated |
||
mimic(&h, x86OCPContentRootDir) | ||
err := h.Handle(event) | ||
statuses := []corev1.ConditionStatus{corev1.ConditionFalse, corev1.ConditionTrue, corev1.ConditionTrue, corev1.ConditionTrue, corev1.ConditionFalse, corev1.ConditionFalse, corev1.ConditionFalse} | ||
|
@@ -98,6 +107,7 @@ func TestWithArchDist(t *testing.T) { | |
conditions, | ||
statuses, t) | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: why do we keep adding empty lines? |
||
} | ||
|
||
func TestWithArch(t *testing.T) { | ||
|
@@ -108,7 +118,7 @@ func TestWithArch(t *testing.T) { | |
v1.PPCArchitecture, | ||
} | ||
err := h.Handle(event) | ||
validate(true, err, "", cfg, conditions, []corev1.ConditionStatus{corev1.ConditionFalse, corev1.ConditionTrue, corev1.ConditionTrue, corev1.ConditionFalse, corev1.ConditionFalse, corev1.ConditionFalse, corev1.ConditionFalse}, t) | ||
validateArchOverride(true, err, "", cfg, conditions, []corev1.ConditionStatus{corev1.ConditionFalse, corev1.ConditionTrue, corev1.ConditionTrue, corev1.ConditionFalse, corev1.ConditionFalse, corev1.ConditionFalse, corev1.ConditionFalse}, t, v1.PPCArchitecture) | ||
} | ||
|
||
func TestWithBadArch(t *testing.T) { | ||
|
@@ -1280,7 +1290,7 @@ func mimic(h *Handler, topdir string) { | |
|
||
} | ||
|
||
func validate(succeed bool, err error, errstr string, cfg *v1.Config, statuses []v1.ConfigConditionType, conditions []corev1.ConditionStatus, t *testing.T) { | ||
func validateArchOverride(succeed bool, err error, errstr string, cfg *v1.Config, statuses []v1.ConfigConditionType, conditions []corev1.ConditionStatus, t *testing.T, arch string) { | ||
if succeed && err != nil { | ||
t.Fatal(err) | ||
} | ||
|
@@ -1307,9 +1317,22 @@ func validate(succeed bool, err error, errstr string, cfg *v1.Config, statuses [ | |
t.Fatalf("unexpected for succeed %v have status condition %#v expected condition %#v and status %#v", succeed, cfg.Status.Conditions[i], c, conditions[i]) | ||
} | ||
} | ||
testValue := arch | ||
if testValue == v1.AMDArchitecture { | ||
testValue = v1.X86Architecture | ||
} | ||
if cfg.Spec.Architectures[0] != testValue { | ||
t.Fatalf("arch set to %s instead of %s", cfg.Spec.Architectures[0], runtime.GOARCH) | ||
} | ||
} | ||
|
||
} | ||
|
||
func validate(succeed bool, err error, errstr string, cfg *v1.Config, statuses []v1.ConfigConditionType, conditions []corev1.ConditionStatus, t *testing.T) { | ||
validateArchOverride(succeed, err, errstr, cfg, statuses, conditions, t, runtime.GOARCH) | ||
} | ||
|
||
|
||
func NewTestHandler() Handler { | ||
h := Handler{} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we always set this, and vary whether or not it is reported based on the
Available
status?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no we shouldn't ... all that was sorted out in 4.0/4.1 initial dev
only report the version once you have achieved it