Skip to content

Commit

Permalink
fix(openshift): build fails with imageStream for buildRecreate value
Browse files Browse the repository at this point in the history
No need to convert value to lowercase when parsing string value to enum

Signed-off-by: Rohan Kumar <[email protected]>
  • Loading branch information
rohanKanojia authored Sep 5, 2024
1 parent c2c9a0c commit 2fd7dbc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Usage:
### 1.18-SNAPSHOT
* Fix #1125: Support WebFlux SpringBoot projects when it comes to generate probes for actuators
* Fix #2844: `oc:build` on openshift use `pods/log` to retrieve logs from build
* Fix #3354: Build fails with `imageStream` for `buildRecreate` value

### 1.17.0 (2024-08-13)
* Fix #494: Support for Micronaut Framework Native Images
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static BuildRecreateMode fromParameter(String param) {
} else if (param.equalsIgnoreCase("true")) {
return all;
}
return valueOf(param.toLowerCase());
return valueOf(param);
}

BuildRecreateMode(boolean bc, boolean is) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2019 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at:
*
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.jkube.kit.common;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.stream.Stream;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.junit.jupiter.params.provider.Arguments.arguments;

class BuildRecreateModeTest {
static Stream<Arguments> fromParameterSource() {
return Stream.of(
arguments("buildConfig", BuildRecreateMode.buildConfig),
arguments("bc", BuildRecreateMode.bc),
arguments("imageStream", BuildRecreateMode.imageStream),
arguments("is", BuildRecreateMode.is),
arguments("all", BuildRecreateMode.all),
arguments("none", BuildRecreateMode.none)
);
}

@ParameterizedTest(name = "fromParameter({0}) should return {1}")
@MethodSource("fromParameterSource")
void fromParameter_shouldParseEnumCorrectly(String param, BuildRecreateMode expectedValue) {
assertThat(BuildRecreateMode.fromParameter(param)).isEqualTo(expectedValue);
}
}

0 comments on commit 2fd7dbc

Please sign in to comment.