Skip to content
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

feat: Add multi-namespace test for scaling #75

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LucasRoesler
Copy link
Member

Rewrite the scaling tests into a table driven test and add support to
running in multiple namespaces.

Testing

kind create cluster

arkade install openfaas --basic-auth=false --clusterrole

kubectl create namespace certifier-test
kubectl annotate namespace/certifier-test openfaas="1"

export CERTIFIER_NAMESPACES=certifier-test

kubectl port-forward -n openfaas svc/gateway 8080:8080 &
make test-kubernetes

Resolves #70

Rewrite the scaling tests into a table driven test and add support to
running in multiple namespaces.

**Testing**

```sh
kind create cluster

arkade install openfaas --basic-auth=false --clusterrole

kubectl create namespace certifier-test
kubectl annotate namespace/certifier-test openfaas="1"

export CERTIFIER_NAMESPACES=certifier-test

kubectl port-forward -n openfaas svc/gateway 8080:8080 &
make test-kubernetes
```

Resolves openfaas#70

Signed-off-by: Lucas Roesler <[email protected]>
Copy link
Contributor

@viveksyngh viveksyngh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, few minor comments which are not blocker and can be improved in subsequent PR.

t.Helper()

// the CLI sdk does not currently support manually scaling
gwURL := resourceURL(t, path.Join("system", "scale-function", name), "")
gwURL := resourceURL(t, path.Join("system", "scale-function", name), fmt.Sprintf("namespace=%s", namespace))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you have checked latest version of CLI SDK, it already has API for scaling functions https://github.com/openfaas/faas-cli/blob/master/proxy/scale.go

Probably we can use that or make an separate MR to update that.

tests/main_test.go Show resolved Hide resolved
if fnc.Replicas != minReplicas {
t.Fatalf("got %d replicas, wanted %d", fnc.Replicas, minReplicas)
}
type scalingTestCase struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really Nice refactoring !!

@alexellis
Copy link
Member

Sorry I missed this. Could you trigger a rebuild since the last 3 commits seem to have failed CI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add multi-namespace support for scaling test cases
3 participants