mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: sleeper image is now deprecated (#736)
Please use fn-test-utils instead for testing.
This commit is contained in:
committed by
Reed Allman
parent
f76648a18a
commit
6b5486c699
6
Makefile
6
Makefile
@@ -18,7 +18,7 @@ checkfmt:
|
||||
|
||||
clear-images:
|
||||
-docker images -q -f dangling=true | xargs docker rmi -f
|
||||
for i in fnproject/fn-test-utils fnproject/hello fnproject/error fnproject/sleeper fnproject/error \
|
||||
for i in fnproject/fn-test-utils fnproject/hello fnproject/error \
|
||||
fnproject/dind fnproject/fnserver fnproject/fnlb; do \
|
||||
docker images "$$i" --format '{{ .ID }}\t{{ .Repository }}\t{{ .Tag}}' | while read id repo tag; do \
|
||||
if [ "$$tag" = "<none>" ]; then docker rmi "$$id"; else docker rmi "$$repo:$$tag"; fi; done; done
|
||||
@@ -56,8 +56,6 @@ build-static:
|
||||
|
||||
full-test: build-static test test-api
|
||||
|
||||
img-sleeper:
|
||||
docker pull fnproject/sleeper
|
||||
img-error:
|
||||
docker pull fnproject/error
|
||||
img-hello:
|
||||
@@ -69,7 +67,7 @@ img-postgres:
|
||||
img-minio:
|
||||
docker pull minio/minio
|
||||
|
||||
pull-images: img-sleeper img-error img-hello img-mysql img-postgres img-minio
|
||||
pull-images: img-error img-hello img-mysql img-postgres img-minio
|
||||
|
||||
test-datastore:
|
||||
cd api/datastore && go test -v ./...
|
||||
|
||||
@@ -61,8 +61,8 @@ func checkExpectedHeaders(t *testing.T, expectedHeaders http.Header, receivedHea
|
||||
|
||||
func TestCallConfigurationRequest(t *testing.T) {
|
||||
appName := "myapp"
|
||||
path := "/sleeper"
|
||||
image := "fnproject/sleeper"
|
||||
path := "/"
|
||||
image := "fnproject/fn-test-utils"
|
||||
const timeout = 1
|
||||
const idleTimeout = 20
|
||||
const memory = 256
|
||||
@@ -192,8 +192,8 @@ func TestCallConfigurationRequest(t *testing.T) {
|
||||
|
||||
func TestCallConfigurationModel(t *testing.T) {
|
||||
appName := "myapp"
|
||||
path := "/sleeper"
|
||||
image := "fnproject/sleeper"
|
||||
path := "/"
|
||||
image := "fnproject/fn-test-utils"
|
||||
const timeout = 1
|
||||
const idleTimeout = 20
|
||||
const memory = 256
|
||||
@@ -253,8 +253,8 @@ func TestCallConfigurationModel(t *testing.T) {
|
||||
|
||||
func TestAsyncCallHeaders(t *testing.T) {
|
||||
appName := "myapp"
|
||||
path := "/sleeper"
|
||||
image := "fnproject/sleeper"
|
||||
path := "/"
|
||||
image := "fnproject/fn-test-utils"
|
||||
const timeout = 1
|
||||
const idleTimeout = 20
|
||||
const memory = 256
|
||||
@@ -526,10 +526,10 @@ func TestGetCallReturnsResourceImpossibility(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// return a model with all fields filled in with fnproject/sleeper image, change as needed
|
||||
// return a model with all fields filled in with fnproject/fn-test-utils:latest image, change as needed
|
||||
func testCall() *models.Call {
|
||||
appName := "myapp"
|
||||
path := "/sleeper"
|
||||
path := "/"
|
||||
image := "fnproject/fn-test-utils:latest"
|
||||
const timeout = 10
|
||||
const idleTimeout = 20
|
||||
|
||||
2
images/sleeper/.gitignore
vendored
2
images/sleeper/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
bundle/
|
||||
.bundle/
|
||||
@@ -1,9 +0,0 @@
|
||||
FROM fnproject/ruby:dev
|
||||
|
||||
WORKDIR /function
|
||||
ADD Gemfile* /function/
|
||||
RUN bundle install
|
||||
|
||||
ADD . /function/
|
||||
|
||||
ENTRYPOINT ["ruby", "func.rb"]
|
||||
@@ -1,3 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'json', '> 1.8.2'
|
||||
@@ -1,10 +0,0 @@
|
||||
# Sleeper Function Image
|
||||
|
||||
This function sleeps for some number of seconds that you pass in.
|
||||
|
||||
Test it with:
|
||||
|
||||
```sh
|
||||
fn build
|
||||
echo '{"sleep": 5}' | fn run
|
||||
```
|
||||
@@ -1,16 +0,0 @@
|
||||
require 'json'
|
||||
|
||||
payload = STDIN.read
|
||||
if payload != ""
|
||||
payload = JSON.parse(payload)
|
||||
|
||||
# payload contains checks
|
||||
if payload["sleep"]
|
||||
i = payload['sleep'].to_i
|
||||
STDERR.puts "Sleeping for #{i} seconds..."
|
||||
sleep i
|
||||
puts "I'm awake!" # sending this to stdout for sync response
|
||||
end
|
||||
else
|
||||
puts "ERROR: please pass in a sleep value: {\"sleep\": 5}"
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
name: fnproject/sleeper
|
||||
version: 0.0.4
|
||||
@@ -1,5 +0,0 @@
|
||||
set -e
|
||||
|
||||
docker build -t fnproject/sleeper:latest .
|
||||
|
||||
docker push fnproject/sleeper:latest
|
||||
Reference in New Issue
Block a user