From 3294528633ce00e3ee932b2e638d7f4d4592556b Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Tue, 1 Oct 2019 10:16:23 +1300 Subject: [PATCH 1/2] Add resource usage docs --- .../devel/sig-testing/writing-good-e2e-tests.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/contributors/devel/sig-testing/writing-good-e2e-tests.md b/contributors/devel/sig-testing/writing-good-e2e-tests.md index 836479c2e..ee82a197c 100644 --- a/contributors/devel/sig-testing/writing-good-e2e-tests.md +++ b/contributors/devel/sig-testing/writing-good-e2e-tests.md @@ -229,3 +229,16 @@ Unreachable nodes are evacuated and then repopulated upon rejoining [Disruptive] Note that opening issues for specific better tooling is welcome, and code implementing that tooling is even more welcome :-). +### Resource usage ### +When writing tests, resources used in the tests should be chosen specifically and sanely quanified. + +Therefore it is important to use resources that are: +1. appropriate to the test +2. inexpensive (containing little or no overhead) +3. create just as many an needed, no more + +For example: +1. only using the resource type which is appropriate to the `test/e2e//` +2. the resource type `ConfigMap` is inexpensive, common, and stateless. It should be used for such things as fetching created resources +3. although the clusters used for testing are generally beefy, an overamount of resources should not be created as it is unnecessary + From 2aa77f1a77fede208da50053a50db3e02aaca0d8 Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Wed, 2 Oct 2019 09:46:45 +1300 Subject: [PATCH 2/2] Add clean up docs --- contributors/devel/sig-testing/writing-good-e2e-tests.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contributors/devel/sig-testing/writing-good-e2e-tests.md b/contributors/devel/sig-testing/writing-good-e2e-tests.md index ee82a197c..39727ea50 100644 --- a/contributors/devel/sig-testing/writing-good-e2e-tests.md +++ b/contributors/devel/sig-testing/writing-good-e2e-tests.md @@ -236,9 +236,11 @@ Therefore it is important to use resources that are: 1. appropriate to the test 2. inexpensive (containing little or no overhead) 3. create just as many an needed, no more +4. should be cleaned up at the end of the tests's run For example: 1. only using the resource type which is appropriate to the `test/e2e//` 2. the resource type `ConfigMap` is inexpensive, common, and stateless. It should be used for such things as fetching created resources 3. although the clusters used for testing are generally beefy, an overamount of resources should not be created as it is unnecessary +4. using afterEach, make sure that your test destroys any resources leftover from the test