Update documentation, MakeFile, and Integration Test Used

This commit is contained in:
Abdul Rabbani 2022-03-03 16:26:41 -05:00
parent eafca5d771
commit 09e91b0826
3 changed files with 60 additions and 2 deletions

View File

@ -14,6 +14,12 @@ integrationtest: | $(GINKGO) $(GOOSE)
go fmt ./... go fmt ./...
$(GINKGO) -r test/ -v $(GINKGO) -r test/ -v
.PHONY: integrationtest_blockchain
integrationtest_blockchain: | $(GINKGO) $(GOOSE)
go vet ./...
go fmt ./...
$(GINKGO) -r validator_test/ -v
.PHONY: integrationtest_local .PHONY: integrationtest_local
integrationtest_local: | $(GINKGO) $(GOOSE) integrationtest_local: | $(GINKGO) $(GOOSE)
go vet ./... go vet ./...

View File

@ -1,4 +1,15 @@
# Validator-README - [Validator-README](#validator-readme)
- [Overview](#overview)
- [Intention for the Validator](#intention-for-the-validator)
- [Edge Cases](#edge-cases)
- [Instructions for Testing](#instructions-for-testing)
- [Code Overview](#code-overview)
- [Known Bugs](#known-bugs)
- [Tests on 03/03/22](#tests-on-03-03-22)
- [Set Up](#set-up)
- [Testing Failures](#testing-failures)
<small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small>
# Overview # Overview
@ -24,3 +35,44 @@ To run the test, do the following:
1. Make sure `GOPATH` is set in your `~/.bashrc` or `~/.bash_profile`: `export GOPATH=$(go env GOPATH)` 1. Make sure `GOPATH` is set in your `~/.bashrc` or `~/.bash_profile`: `export GOPATH=$(go env GOPATH)`
2. `./scripts/run_integration_test.sh` 2. `./scripts/run_integration_test.sh`
# Code Overview
This section will provide some insight into specific files and their purpose.
- `validator_test/chain_maker.go` - This file contains the code for creating a “test” blockchain.
- `validator_test/validator_test.go` - This file contains testing to validate the validator. It leverages `chain_maker.go` to create a blockchain to validate.
- `pkg/validator/validator.go` - This file contains most of the core logic for the validator.
# Known Bugs
1. The validator is improperly handling missing headers from the database.
1. Scenario
1. The IPLD blocks from the mock blockchain are inserted into the Postgres Data.
2. The validator runs, and all tests pass.
3. Users manually remove the last few rows from the database.
4. The validator runs, and all tests pass - This behavior is neither expected nor wanted.
# Tests on 03/03/22
The tests highlighted below were conducted to validate the initial behavior of the validator.
## Set Up
Below are the steps utilized to set up the test environment.
1. Run the `scripts/run_integration_test.sh` script.
1. First comment outline 130 to 133 from `validator_test/validator_test.go`
2. Once the code has completed running, comment out lines 55 to 126, 38 to 40, and 42 to 44.
1. Make the following change `db, err = setupDB() --> db, _ = setupDB()`
3. Run the following command: `ginkgo -r validator_test/ -v`
1. All tests should pass
## Testing Failures
Once we had populated the database, we tested for failures.
1. Removing a Transaction from `transaction_cids` - If we removed a transaction from the database and ran the test, the test would fail. **This is the expected behavior.**
2. Removing Headers from `eth.header_cids`
1. If we removed a header block sandwiched between two header blocks, the test would fail (For example, we removed the entry for block 4, and the block range is 1-10). **This is the expected behavior.**
2. If we removed the tail block(s) from the table, the test would pass (For example, we remove the entry for blocks 8, 9, 10, and the block range is 1-10). **This is _not_ the expected behavior.**

View File

@ -20,4 +20,4 @@ export DATABASE_HOSTNAME=127.0.0.1
# Wait for containers to be up and execute the integration test. # Wait for containers to be up and execute the integration test.
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \ while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
make integrationtest make integrationtest_blockchain