Skip to content

Instantly share code, notes, and snippets.

@lordofthejars
Last active November 14, 2017 16:14
Show Gist options
  • Save lordofthejars/81cf2db55145873c9242719efe1c3f24 to your computer and use it in GitHub Desktop.
Save lordofthejars/81cf2db55145873c9242719efe1c3f24 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: Template
metadata:
creationTimestamp: null
name: hello
objects:
- apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
name: hello-openshift-service
spec:
ports:
- name: hello-openshift-service
port: 8080
protocol: TCP
targetPort: 8080
selector:
name: hello-openshift-service
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
- apiVersion: v1
kind: Pod
metadata:
annotations:
openshift.io/scc: restricted
creationTimestamp: null
labels:
name: hello-openshift-service
name: hello-openshift
spec:
containers:
- image: openshift/hello-openshift
imagePullPolicy: IfNotPresent
name: hello-openshift
ports:
- containerPort: 8080
protocol: TCP
resources: {}
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: default-dockercfg-lcz2g
nodeName: localhost
restartPolicy: Always
terminationGracePeriodSeconds: 30
@RunWith(ArquillianConditionalRunner.class)
@RequiresOpenshift
@Template(url = "https://gist.githubusercontent.com/lordofthejars/81cf2db55145873c9242719efe1c3f24/raw/27188fae3ebc1375f0645ac1a22cb3fe6980ca36/hello-template.yaml")
public class HelloWorldTemplateTest {
@Named("hello-openshift-service")
@PortForward
@ArquillianResource
URL url;
@Test
public void should_show_hello_world() throws IOException {
assertThat(url).isNotNull();
OkHttpClient okHttpClient = new OkHttpClient();
Request request = new Request.Builder().get().url(url).build();
Response response = okHttpClient.newCall(request).execute();
assertThat(response).isNotNull();
assertThat(response.code()).isEqualTo(200);
assertThat(response.body().string()).isEqualTo("Hello OpenShift!\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment