Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2022-08-23 14:17:48 +0300
committerToon Claes <toon@gitlab.com>2022-08-23 14:17:48 +0300
commit1a072655fa3c26ede5f6809947ca977f59c1c202 (patch)
tree9a8365078b4b006db17f8912e85e294d11edb6bb
parenta37953ec67590763051aa6552876910560874cfd (diff)
parent2bcafb150113cc51f91d05f78da684eada42fa33 (diff)
Merge branch 'pks-doc-discourage-seeded-test-repos' into 'master'
STYLE.md: Discourage the use of seed repos for test data Closes #4308 See merge request gitlab-org/gitaly!4799
-rw-r--r--STYLE.md15
1 files changed, 15 insertions, 0 deletions
diff --git a/STYLE.md b/STYLE.md
index fbf61a061..667973ee5 100644
--- a/STYLE.md
+++ b/STYLE.md
@@ -243,6 +243,21 @@ tests are supposed to set up required state as part of the tests themselves. All
`TestMain()` functions must call `testhelper.Run()` though, which performs the
setup of global state required for tests.
+### Test data
+
+Tests should not rely on static Git data but instead generate test data at
+runtime if possible. This is done so that we can easily adapt to changes in
+Git's repository or object format, e.g. in the transition from the SHA1 to the
+SHA256 object hash. Using seed repositories is thus discouraged.
+
+As an alternative, tests can rely on the following helper functions to generate
+their test data:
+
+- `gittest.WriteCommit()`
+- `gittest.WriteTree()`
+- `gittest.WriteBlob()`
+- `gittest.WriteTag()`
+
## Black box and white box testing
The dominant style of testing in Gitaly is "white box" testing, meaning