Skip to content

Commit

Permalink
Merge pull request #427 from oasisprotocol/mitjat/sapphire-is-valid-l…
Browse files Browse the repository at this point in the history
…ayer

api: Recognize sapphire, cipher as valid Layer values
  • Loading branch information
mitjat authored May 26, 2023
2 parents 00875f1 + b779852 commit 6837a30
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 2,447 deletions.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,23 @@ fill-cache-for-e2e-regression: oasis-indexer

# Run the api tests locally, assuming the environment is set up with an oasis-node that is
# accessible as specified in the config file.
test-e2e-regression: export TZ=UTC
test-e2e-regression: oasis-indexer
./oasis-indexer --config tests/e2e_regression/e2e_config.yml analyze
@$(ECHO) "$(CYAN)*** Indexer finished; starting api tests...$(OFF)"
./tests/e2e_regression/run.sh

# Accept the outputs of the e2e tests as the new expected outputs.
accept-e2e-regression:
@# Delete all old expected files first, in case any test cases were renamed or removed.
rm -rf ./tests/e2e_regression/expected
@# Copy the actual outputs to the expected outputs.
cp -r ./tests/e2e_regression/{actual,expected}
@# The result of the "spec" test is a special case. It should always match the
@# current openAPI spec file, so we symlink it to avoid having to update the expected
@# output every time the spec changes.
rm ./tests/e2e_regression/expected/spec.body
ln -s ../../../api/spec/v1.yaml ./tests/e2e_regression/expected/spec.body

# Format code.
fmt:
@$(ECHO) "$(CYAN)*** Running Go formatters...$(OFF)"
Expand Down Expand Up @@ -137,6 +148,10 @@ release-build: codegen-go
all build \
codegen-go \
oasis-indexer \
test-e2e \
test-e2e-regression \
fill-cache-for-e2e-regression \
accept-e2e-regression \
docker \
clean \
test \
Expand Down
4 changes: 4 additions & 0 deletions api/spec/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1078,10 +1078,14 @@ components:
schemas:
Layer:
type: string
# NOTE: Change IsValid() in util.go if you change this.
# https://github.com/oasisprotocol/oasis-indexer/blob/v0.0.16/api/v1/types/util.go#L40
enum: [emerald, sapphire, cipher, consensus]

Runtime:
type: string
# NOTE: Change IsValid() in util.go if you change this.
# https://github.com/oasisprotocol/oasis-indexer/blob/v0.0.16/api/v1/types/util.go#L49
enum: [emerald, sapphire, cipher]

List:
Expand Down
2 changes: 1 addition & 1 deletion api/v1/types/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (c ConsensusEventType) IsValid() bool {

func (c Layer) IsValid() bool {
switch c {
case LayerConsensus, LayerEmerald:
case LayerConsensus, LayerCipher, LayerEmerald, LayerSapphire:
return true
default:
return false
Expand Down
Loading

0 comments on commit 6837a30

Please sign in to comment.