test-service

command module
v0.0.0-...-0c14586 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 10 Imported by: 0

README

Overview

Simple container that expose a service with common endpoints for testing a service (echo, echoheaders, hostname, fqdn, ip).

Usage

docker run -d -p 8080:8080 --rm benbaker76/service

** /echo endpoint **

curl --data "hello echo" localhost:8080/echo

Returns echo of the request body.

** /echoheaders endpoint **

curl localhost:8080/echoheaders

Returns echo of the request headers.

** /hostname endpoint **

curl localhost:8080/hostname

Returns the container hostname.

** /fqdn endpoint **

curl localhost:8080/fqdn

Returns the container fully qualified name.

** /ip endpoint **

curl localhost:8080/ip

Returns the list of containers ip.

** /env endpoint **

curl localhost:8080/env

Returns the list of container env variables.

** /exit/exitCode endpoint **

curl localhost:8080/exit/0
curl localhost:8080/exit/1

Exit from the service and returns the given code

Kubernetes

$ kubectl apply -f test-service.yaml
$ kubectl expose deployment test-service --type=NodePort
$ kubectl get service
NAME           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes     ClusterIP   10.96.0.1       <none>        443/TCP          44m
test-service   NodePort    10.103.145.50   <none>        8080:31562/TCP   9s
$ curl --data "hello echo" mycluster-cp:31562/echo
hello echo

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL