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

New Feature: Lookup Boxes by app-id + Name and Search Boxes by app-id #1117

Merged
merged 241 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
241 commits
Select commit Hold shift + click to select a range
12f8c2f
Local Ledger (#1011)
shiqizng Jun 8, 2022
45b9dbe
Local Ledger Deployment (#1013)
shiqizng Jun 8, 2022
d40c76b
add deleted opts
shiqizng Jun 9, 2022
eff4e6f
fast catchup (#1023)
shiqizng Jun 13, 2022
5a56ad2
Localledger merge (#1036)
Eric-Warehime Jun 16, 2022
5a03dc8
recovery scenario (#1024)
shiqizng Jun 16, 2022
621c135
refactor create genesis block (#1026)
shiqizng Jun 17, 2022
a6c85a4
Adds Local Ledger Readme (#1035)
AlgoStephenAkiki Jun 21, 2022
5f5c7fe
update ledger file path and migration (#1042)
shiqizng Jun 22, 2022
5584c6d
LocalLedger Refactoring + Catchpoint Service (#1049)
winder Jun 23, 2022
409d725
build: merge develop into localledger/integration (#1062)
Eric-Warehime Jun 24, 2022
2d33cf1
wip - need to clean up deprecated, add tests, point to the right go-a…
Jun 27, 2022
fc9600b
Merge branch 'localledger/integration' into tzaffi/box-ingest
Jun 27, 2022
6d705a5
fix bad merge
Jun 27, 2022
4f15f90
compiler warning fixes
Jun 27, 2022
b549903
something in this commit broke the block processor...
Jun 27, 2022
793b91e
Update Makefile
tzaffi Jun 27, 2022
7b46278
Update Makefile
tzaffi Jun 27, 2022
75bf63e
Update Makefile
tzaffi Jun 27, 2022
6f10dc5
Update accounting/eval_preload.go
tzaffi Jun 27, 2022
947bb30
Update accounting/eval_preload.go
tzaffi Jun 27, 2022
62d2701
Update processor/blockprocessor/block_processor.go
tzaffi Jun 27, 2022
4d6ab96
Update idb/postgres/internal/schema/setup_postgres.sql
tzaffi Jun 28, 2022
a1a08b2
Ledger init status (#1058)
shiqizng Jun 28, 2022
f40e112
Generate an error if the catchpoint is not valid for initialization. …
winder Jun 29, 2022
932e0cf
Use main logger in handler and fetcher. (#1077)
winder Jun 29, 2022
fc53390
rename app_box column box_name + dump the transaction which had an un…
Jun 29, 2022
db9be46
Merge branch 'tzaffi/box-ingest' of github.com:algorand/indexer into …
Jun 29, 2022
8ece29f
Update processor/blockprocessor/block_processor.go
tzaffi Jun 29, 2022
f20fa8f
Update idb/postgres/internal/writer/writer.go
tzaffi Jun 29, 2022
b8b1ebc
Update idb/postgres/internal/writer/writer.go
tzaffi Jun 29, 2022
71124eb
Update idb/postgres/internal/writer/writer.go
tzaffi Jun 29, 2022
203cb60
Merge branch 'localledger/integration' into tzaffi/box-ingest
Jun 29, 2022
6c169b9
Merge remote-tracking branch 'origin' into tzaffi/box-ingest
Jun 29, 2022
997719a
Switch from fullNode catchup to catchpoint catchup service. (#1076)
winder Jun 29, 2022
f3f1177
Refactor daemon, add more tests (#1039)
Eric-Warehime Jun 29, 2022
44062f1
Merge remote-tracking branch 'origin/localledger/integration' into tz…
Jun 30, 2022
8dbd734
temporary REPOINT .gitmodules to tzaffi/go-algorand zbox2 branch
Jun 30, 2022
572884f
manually set to latest from localledger/integration
Jun 30, 2022
0c7e018
delete the corresponding app_box row when a box is deleted
Jun 30, 2022
370d916
remove created_at as well from app_box'es schema
Jun 30, 2022
6b24968
Merge develop into localledger/integration (#1083)
winder Jun 30, 2022
f72a4e9
Merge remote-tracking branch 'origin/localledger/integration' into tz…
Jun 30, 2022
f977817
Merge branch 'develop' into localledger/integration
winder Jun 30, 2022
b971b1b
Merge remote-tracking branch 'origin/localledger/integration' into tz…
Jun 30, 2022
94395bb
get latest submodule
Jun 30, 2022
f2c68bb
Update idb/postgres/internal/writer/writer.go
tzaffi Jul 1, 2022
461b0a0
Update idb/postgres/internal/writer/writer.go
tzaffi Jul 1, 2022
eb46c03
remove comment and duplicated code
Jul 1, 2022
1d2dfe9
Merge branch 'tzaffi/box-ingest' of github.com:algorand/indexer into …
Jul 1, 2022
a2ba38c
update go-algorand commit + more expansive comment
Jul 1, 2022
1b89a6b
Misc Local Ledger cleanup (#1086)
winder Jul 5, 2022
e81f7cc
add a random test for boxes
Jul 6, 2022
d076704
complete random box test + follow thru some implications of Deprected…
Jul 6, 2022
f93fb17
Merge remote-tracking branch 'origin/localledger/integration' into tz…
Jul 6, 2022
028c19b
merge from localledger branch
Jul 6, 2022
77b74d8
lint
Jul 6, 2022
7f8363c
revert from main integration branch
Jul 6, 2022
0290cc3
Update processor/blockprocessor/initialize.go
winder Jul 6, 2022
f814026
Merge branch 'localledger/integration' into tzaffi/box-ingest
Jul 6, 2022
5f27d06
Update idb/postgres/internal/writer/writer.go
tzaffi Jul 6, 2022
f0eb04c
comment out for now encoding test for boxes
Jul 6, 2022
fc51b82
remove commented out code
Jul 7, 2022
0cd574a
boxes test simulating insertion/mutation/deletion
Jul 7, 2022
ceb0756
Update idb/postgres/internal/writer/writer.go
tzaffi Jul 7, 2022
b024e16
de-comment
Jul 7, 2022
5e00de3
revert to localledger/integration
Jul 7, 2022
2ec8c75
comment edits
Jul 7, 2022
39e9c55
refactor + LookupKv() unit test stub
Jul 11, 2022
bad49f0
refactor: Old name is more general, and rename old function to align …
Jul 11, 2022
636b379
exportable CompareAppBoxesAgainstDB()
Jul 11, 2022
99193e8
refactor: Old name is more general, and rename old function to align …
Jul 11, 2022
ef43e6a
integration test
Jul 11, 2022
739de14
implement TestLedgerForEvaluatorLookupKv()
Jul 11, 2022
74b7cb1
lint
Jul 11, 2022
6f1d5b1
Update processor/eval/ledger_for_evaluator_test.go
tzaffi Jul 12, 2022
a16993a
update addBlock (#1113)
shiqizng Jul 13, 2022
d5bf812
Misc Local Ledger PR feedback. (#1110)
winder Jul 13, 2022
f7f547a
Merge branch 'localledger/integration' into tzaffi/box-ingest
Jul 13, 2022
2cb5000
Merge branch 'tzaffi/box-ingest' of github.com:algorand/indexer into …
Jul 13, 2022
3f564c9
pin go-algorand to latest
Jul 13, 2022
da6d6a2
update parity job in preperation for boxes swagger
Jul 14, 2022
c643090
amend the swagger and pass the parity check
Jul 14, 2022
eff2cc0
generate the types and routes
Jul 14, 2022
d1d71cd
revert non-box relatedn formatting changes
Jul 14, 2022
7b22d7d
conform boxes swagger to indexer conventions
Jul 14, 2022
728d397
implement first non-auto gen stubs of the box handlers
Jul 14, 2022
43475f5
handle merge from impact from submodule
Jul 14, 2022
b2d26b3
tidy
Jul 14, 2022
b86cb0d
panic-implementation of IndexerDb interface with new method Applicati…
Jul 14, 2022
a941245
should be wired up - no on for the testing
Jul 14, 2022
5416f91
Merge remote-tracking branch 'origin' into tzaffi/box-search
Jul 15, 2022
ee57d14
Merge remote-tracking branch 'origin' into tzaffi/box-ingest
Jul 15, 2022
aa1bd57
update mod & sum
Jul 15, 2022
96f8234
merge conflict
Jul 15, 2022
0ce5275
more DeprecatedLedgerForEvaluator
Jul 19, 2022
fae233a
introduce TestBaseAccountDataVersusAccountBaseDataParity() and fail a…
Jul 19, 2022
4c97227
add TotalBoxes/BoxBytes to baseAccountData and pass TestBaseAccountDa…
Jul 20, 2022
33bc2be
totalboxes/boxbytes is getting upserted properly - but cleanup needed
Jul 20, 2022
c73021c
break out random test file
Jul 21, 2022
771f337
update go-algorand submodule
Jul 21, 2022
32d0367
pass writer test with totals added
Jul 21, 2022
bc0b5e4
revert to original names
Jul 22, 2022
b0dfdaa
revert to original names
Jul 22, 2022
4c840b7
forgot to send the name revert upstream
Jul 22, 2022
d9ea30d
Migration for app_box in a D.R.Y. manner
Jul 23, 2022
0598f73
Merge branch 'develop' into tzaffi/box-ingest
Jul 26, 2022
fc9cc64
latest feature/avm-box
Jul 26, 2022
c40c5ec
lint
Jul 26, 2022
401afa9
Merge branch 'develop' into tzaffi/box-ingest
Jul 26, 2022
a54b972
update submodule
Jul 26, 2022
38bce55
Merge branch 'tzaffi/box-ingest' into tzaffi/box-search
Jul 26, 2022
e0b93a7
lint
Jul 27, 2022
0341c20
align swaggers and regen
Jul 27, 2022
436b805
lint
Jul 27, 2022
d0e8839
go generate
Jul 27, 2022
5ea0a8b
copy pasta error
Jul 27, 2022
571c409
reorg
Jul 27, 2022
8c7096d
wth is going on at CI vs local?
Jul 27, 2022
28cf7ea
experiment
Jul 27, 2022
479f846
experiment
Jul 27, 2022
5f2667b
try gin
Jul 27, 2022
34887da
copy pasta the test to handlers and follow implied changes
Jul 28, 2022
0fbd762
Merge branch 'develop' into tzaffi/box-ingest
Jul 28, 2022
68ebea8
Merge branch 'develop' into tzaffi/box-search
Jul 28, 2022
7980a3e
searching and querying for boxes + verifying with box stats from acco…
Jul 29, 2022
329da23
box integration tests
Jul 29, 2022
2bfdd24
generated
Jul 29, 2022
f75bd10
revert
Jul 29, 2022
c57803d
revert
Jul 29, 2022
10e2ff7
black + MaxKeys --> 100
Jul 29, 2022
0a9fd20
black + clearer error messaging when couldn't find e2e tarfile
Jul 29, 2022
bd1ef3f
Merge branch 'develop' into tzaffi/box-ingest
Aug 1, 2022
b60a576
update go-algorand
Aug 1, 2022
004e0ff
fix .gitmodules pointer
Aug 1, 2022
23cd122
update submodule
Aug 2, 2022
2297774
return to non-templated copy/pasta migrations approach
Aug 2, 2022
b335e29
jj's latest feature/avm-box
Aug 3, 2022
a17bc4b
update teal and assembler for new version
Aug 3, 2022
3044502
pass through CI_E2E_FILENAME consistently with go-algorand e2e net ge…
Aug 3, 2022
7a8f9e0
pass through CI_E2E_FILENAME consistently with go-algorand e2e net ge…
Aug 3, 2022
6daeb20
revert LedgerForEvaluator's BlockHdrCached to Eric's original + misc
Aug 3, 2022
37c0083
Merge branch 'develop' into tzaffi/box-ingest
Aug 3, 2022
68f8965
Revert submodule repo to algorand + pin to latest feature/avm-box commit
Aug 3, 2022
1083909
Merge branch 'tzaffi/box-ingest' into tzaffi/box-search
Aug 4, 2022
d666749
v8
Aug 4, 2022
f786708
revert import alias
Aug 9, 2022
97a862c
package access for compareAppBoxesAgainstDB
Aug 9, 2022
74146f9
protected access for unexported functions
Aug 9, 2022
a2b163c
move final box test from postgrest_integration_test.go to postgres_bo…
Aug 9, 2022
5500b7f
comment grammar
Aug 9, 2022
5b7399e
Merge branch 'integration/boxes' into tzaffi/box-search
Aug 10, 2022
a32ef39
Merge branch 'integration/boxes' into tzaffi/box-search
Aug 10, 2022
800cb13
clean up after merge from integration branch
Aug 10, 2022
8cf6374
errBoxMismatch is obsolete
Aug 10, 2022
2a4c7b1
bad merge
Aug 10, 2022
02263de
revert
Aug 10, 2022
f15130e
fix bad merge
Aug 10, 2022
38db8f6
errant backtick
Aug 10, 2022
5a3603e
box fixtures test - wip
Aug 13, 2022
6383b74
mock router
Aug 13, 2022
ed52492
wip
Aug 14, 2022
094ddc2
refactoring
Aug 14, 2022
b883737
almost done with logic
Aug 15, 2022
72dcb8c
lint + accounts endpoint prover
Aug 15, 2022
15f6759
try port 8999 for fixtures_test.go
Aug 15, 2022
6d41462
gitignore _boxes.json
Aug 15, 2022
f6aa9c0
make paging boxex compliant with indexer expectations
Aug 15, 2022
a506519
codegen
Aug 15, 2022
5902511
fix the fixture with good examples
Aug 15, 2022
9aa9904
functionality GTG - now clean up
Aug 16, 2022
98df20f
added empty `next` b64 encoding case
Aug 17, 2022
dcf2c19
updated go-algorand to latest feature/avm-box commit
Aug 22, 2022
02957b8
swagger with generated
Aug 22, 2022
62068f5
swagger with generated
Aug 22, 2022
3db6e32
Merge branch 'integration/boxes' into tzaffi/box-search
Aug 24, 2022
c62b509
revert
Aug 24, 2022
cd9d510
drop unneeded alias
Aug 24, 2022
406e83a
expected parity diffs
Aug 24, 2022
f46f43f
Apply suggestions from code review
tzaffi Aug 24, 2022
4d7a0d2
Merge branch 'tzaffi/box-search' of github.com:algorand/indexer into …
Aug 24, 2022
cfa313d
parity test
Aug 24, 2022
3457a5a
Update api/indexer.oas2.json
tzaffi Aug 24, 2022
1a03916
go generate...
Aug 24, 2022
059a1bb
commentary
Aug 24, 2022
df2e5ba
revert from integration/boxes branch
Aug 24, 2022
0357986
replace code smell with DRY violation in testing code
Aug 24, 2022
bbd932c
commentary
Aug 24, 2022
1767f78
break out specific test code into app_boxes_fixtures_test.go
Aug 24, 2022
bb6a042
Update api/fixtures_test.go
tzaffi Aug 24, 2022
9f8e860
Update api/fixtures_test.go
tzaffi Aug 24, 2022
d70a0ab
privatize BoxTestComparator
Aug 24, 2022
e232439
privatize BoxTestComparator
Aug 24, 2022
19ab443
Merge branch 'tzaffi/box-search' of github.com:algorand/indexer into …
Aug 24, 2022
cd589e0
privatize BoxTestComparator
Aug 24, 2022
5549d54
Update api/handlers_e2e_test.go
tzaffi Aug 24, 2022
4941982
rename to generatedRandomBoxes()
Aug 24, 2022
8c5ff55
freeze the fixture - so actually run the validation + new non -app ac…
Aug 24, 2022
938f401
Update api/handlers.go
tzaffi Aug 25, 2022
e9e0fda
Update api/indexer.oas2.json
tzaffi Aug 25, 2022
e1f5009
Update api/indexer.oas2.json
tzaffi Aug 25, 2022
0d65499
And instead of and
Aug 25, 2022
5b848c4
remove unused AccountQueryOptions.IncludeBoxTotals
Aug 26, 2022
5f1192e
per CR - x-algorand-format GOALarg is nonsensical where it should be …
Aug 26, 2022
3a9095c
per CR - remove TODO's
Aug 26, 2022
8fb5793
delete unused util/test/box_testutil.go
Aug 26, 2022
7369ac9
Update api/fixtures_test.go
tzaffi Aug 29, 2022
3220cbe
assert that the seed fixture is frozen
Aug 29, 2022
fb71f6d
assert that the fixtures JSON is frozen too, and freeze it
Aug 29, 2022
9cf7f71
add test cases for querying a box without providing the required name…
Aug 29, 2022
8d7265d
adhere to indexer conventions regarding boxes `next-token`
Aug 29, 2022
e8f1769
per CR: add tests that show demonstrate that parameters are checked t…
Aug 30, 2022
b955a31
add the picked up route info to the fixture
Aug 30, 2022
2ffc0bc
per discussion consensus - return b64: prefix in next token + clearer…
Aug 30, 2022
321326a
Update api/handlers.go
tzaffi Aug 30, 2022
4a3c9c0
i before e except after c for fixture
Aug 30, 2022
3149c04
Merge branch 'integration/boxes' into tzaffi/box-search
Sep 1, 2022
8e9801b
re-generate
Sep 1, 2022
3ff2b18
update go-algorand submodule to feature/avm-box latest
Sep 2, 2022
4af9c65
Merge branch 'integration/boxes' into tzaffi/box-search
Sep 2, 2022
61995f5
Merge branch 'integration/boxes' into tzaffi/box-search
Sep 2, 2022
3c2d584
ignore VS Code detritous
Sep 8, 2022
b8d3efc
Merge branch 'integration/boxes' into tzaffi/box-search
Sep 8, 2022
4399ad8
remove pattern per CR and regenerate
Sep 8, 2022
cf5eb43
per CR - more explict condition when getting no query results
Sep 9, 2022
b5025ad
conform to same 404 error for supplying app-id beyond max-int64
Sep 9, 2022
212ac15
Per commitment in morning discussion - Explain fixtures test in the R…
Sep 10, 2022
c0e7349
Update api/README.md
tzaffi Sep 13, 2022
0d966a0
Update api/README.md
tzaffi Sep 13, 2022
db1d35c
Update api/README.md
tzaffi Sep 13, 2022
7e7f849
Update api/README.md
tzaffi Sep 13, 2022
3859cca
Merge branch 'integration/boxes' into tzaffi/box-search
Sep 13, 2022
778349c
Merge branch 'integration/boxes' into tzaffi/box-search
Sep 14, 2022
a18a828
regen
Sep 14, 2022
2d5b7e2
Update api/README.md
tzaffi Sep 14, 2022
9a083a0
Merge branch 'integration/boxes' into tzaffi/box-search
Sep 14, 2022
bf4a72c
merge and percolate refactoring of *string to ledgercore.ValueDelta{D…
Sep 14, 2022
8a7c292
Update api/handlers.go
tzaffi Sep 14, 2022
8dc09fe
Update api/handlers. Go
tzaffi Sep 14, 2022
0cd5707
lint
Sep 14, 2022
f5db6f7
Merge branch 'tzaffi/box-search' of github.com:algorand/indexer into …
Sep 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ tmp/
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Output of fixtures_test.go
_*.json

# Dependency directories (remove the comment below to include it)
# vendor/

Expand All @@ -29,6 +32,9 @@ __pycache__
# jetbrains IDE
.idea

# VS Code
.vscode

.deb_tmp
.tar_tmp
*.deb
Expand Down
102 changes: 102 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ We are using a documentation driven process.
The API is defined using [OpenAPI v2](https://swagger.io/specification/v2/) in **indexer.oas2.yml**.

## Updating REST API

The Makefile will install our fork of **oapi-codegen**, use `make oapi-codegen` to install it directly.

1. Document your changes by editing **indexer.oas2.yml**
Expand All @@ -20,3 +21,104 @@ Specifically, `uint64` types aren't strictly supported by OpenAPI. So we added a
## Why do we have indexer.oas2.yml and indexer.oas3.yml?

We chose to maintain V2 and V3 versions of the spec because OpenAPI v3 doesn't seem to be widely supported. Some tools worked better with V3 and others with V2, so having both available has been useful. To reduce developer burdon, the v2 specfile is automatically converted v3 using [converter.swagger.io](http://converter.swagger.io/).

# Fixtures Test
tzaffi marked this conversation as resolved.
Show resolved Hide resolved
## What is a **Fixtures Test**?

Currently (September 2022) [fixtures_test.go](./fixtures_test.go) is a library that allows testing Indexer's router to verify that endpoints accept parameters and respond as expected, and guard against future regressions. [app_boxes_fixtures_test.go](./app_boxes_fixtures_test.go) is an example _fixtures test_ and is the _creator_ of the fixture [boxes.json](./test_resources/boxes.json).

A fixtures test

1. is defined by a go-slice called a _Seed Fixture_ e.g. [var boxSeedFixture](https://github.com/algorand/indexer/blob/b5025ad640fabac0d778b4cac60d558a698ed560/api/app_boxes_fixtures_test.go#L302-L692) which contains request information for making HTTP requests against an Indexer server
2. iterates through the slice, making each of the defined requests and generating a _Live Fixture_
3. reads a _Saved Fixture_ from a json file e.g. [boxes.json](./test_resources/boxes.json)
4. persists the _Live Fixture_ to a json file not in source control
5. asserts that the _Saved Fixture_ is equal to the _Live Fixture_

In reality, because we always want to save the _Live Fixture_ before making assertions that could fail the test and pre-empt saving, steps (3) and (4) happen in the opposite order.

## What's the purpose of a Fixtures Test?

A fixtures test should allow one to quickly stand up an end-to-end test to validate that Indexer endpoints are working as expected. After Indexer's state is programmatically set up, it's easy to add new requests and verify that the responses look exactly as expected. Once you're satisfied that the responses are correct, it's easy to _freeze_ the test and guard against future regressions.
## What does a **Fixtures Test Function** Look Like?

[func TestBoxes](https://github.com/algorand/indexer/blob/b5025ad640fabac0d778b4cac60d558a698ed560/api/app_boxes_fixtures_test.go#L694_L704) shows the basic structure of a fixtures test.

1. `setupIdbAndReturnShutdownFunc()` is called to set up the Indexer database
* this isn't expected to require modification
2. `setupLiveBoxes()` is used to prepare the local ledger and process blocks in order to bring Indexer into a particular state
* this will always depend on what the test is trying to achieve
* in this case, an app was used to create and modify a set of boxes which are then queried against
* it is conceivable that instead of bringing Indexer into a particular state, the responses from the DB or even the handler may be mocked, so we could have had `setupLiveBoxesMocker()` instead of `setupLiveBoxes()`
3. `setupLiveServerAndReturnShutdownFunc()` is used to bring up an instance of a real Indexer.
* this shouldn't need to be modified; however, if running in parallel and making assertions that conflict with other tests, you may need to localize the variable `fixtestListenAddr` and run on a separate port
* if running a mock server instead, a different setup function would be needed
4. `validateLiveVsSaved()` runs steps (1) through (5) defined in the previous section
* this is designed to be generic and ought not require much modification going forward


## Which Endpoints are Currently _Testable_ in a Fixtures Test?

Endpoints defined in [proverRoutes](https://github.com/algorand/indexer/blob/b955a31b10d8dce7177383895ed8e57206d69f67/api/fixtures_test.go#L232-L263) are testable.

Currently (September 2022) these are:

* `/v2/accounts`
* `/v2/applications`
* `/v2/applications/:application-id`
* `/v2/applications/:application-id/box`
* `/v2/applications/:application-id/boxes`

## How to Introduce a New Fixtures Test for an _Already Testable_ Endpoint?

To set up a new test for endpoints defined above one needs to:

### 1. Define a new _Seed Fixture_

For example, consider

```go
var boxSeedFixture = fixture{
File: "boxes.json",
Owner: "TestBoxes",
Frozen: true,
Cases: []testCase{
// /v2/accounts - 1 case
{
Name: "What are all the accounts?",
Request: requestInfo{
Path: "/v2/accounts",
Params: []param{},
},
},
...
```

A seed fixture is a `struct` with fields
* `File` (_required_) - the name in [test_resources](./test_resources/) where the fixture is read from (and written to with an `_` prefix)
* `Owner` (_recommended_) - a name to define which test "owns" the seed
* `Frozen` (_required_) - set _true_ when you need to run assertions of the _Live Fixture_ vs. the _Saved Fixture_. For tests to pass, it needs to be set _true_.
* `Cases` - the slice of `testCase`s. Each of these has the fields:
* `Name` (_required_) - an identifier for the test case
* `Request` (_required_) - a `requestInfo` struct specifying:
* `Path` (_required_) - the path to be queried
* `Params` (_required but may be empty_) - the slice of parameters (strings `name` and `value`) to be appended to the path
### 2. Define a new _Indexer State_ Setup Function

There are many examples of setting up state that can be emulated. For example:
* [setupLiveBoxes()](https://github.com/algorand/indexer/blob/b5025ad640fabac0d778b4cac60d558a698ed560/api/app_boxes_fixtures_test.go#L43) for application boxes
* [TestApplicationHandlers()](https://github.com/algorand/indexer/blob/3a9095c2b5ee25093708f980445611a03f2cf4e2/api/handlers_e2e_test.go#L93) for applications
* [TestBlockWithTransactions()](https://github.com/algorand/indexer/blob/800cb135a0c6da0109e7282acf85cbe1961930c6/idb/postgres/postgres_integration_test.go#L339) setup state consisting of a set of basic transactions

## How to Make a _New Endpoint_ Testable by Fixtures Tests?

There are 2 steps:

1. Implement a new function _witness generator_ aka [prover function](https://github.com/algorand/indexer/blob/b955a31b10d8dce7177383895ed8e57206d69f67/api/fixtures_test.go#L103) of type `func(responseInfo) (interface{}, *string)` as examplified in [this section](https://github.com/algorand/indexer/blob/b955a31b10d8dce7177383895ed8e57206d69f67/api/fixtures_test.go#L107-L200). Such a function is supposed to parse an Indexer response's body into a generated model. Currently, all provers are boilerplate, and with generics, it's expected that this step will no longer be necessary (this [POC](https://github.com/tzaffi/indexer/blob/generic-boxes/api/fixtures_test.go#L119-L155) shows how it would be done with generics).
2. Define a new route in the [proverRoutes struct](https://github.com/algorand/indexer/blob/b955a31b10d8dce7177383895ed8e57206d69f67/api/fixtures_test.go#L232_L263). This is a tree structure which is traversed by splitting a path using `/` and eventually reaching a leaf which consists of a `prover` as defined in #1.

For example, to enable the endpoint `GET /v2/applications/{application-id}/logs` for fixtures test, one need only define a `logsProof` witness generator and have it mapped in `proverRoutes` under:

```
proverRoutes.parts["v2"].parts["applications"].parts[":application-id"].parts["logs"] = logsProof
```
Loading