Skip to content

Commit f62dc06

Browse files
authored
move omg_performance json rpc tests to perf project (#1691)
1 parent b3081f8 commit f62dc06

37 files changed

+976
-1004
lines changed

.circleci/config.yml

Lines changed: 78 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,43 @@ commands:
5555
name: Attach workspace
5656
at: .
5757

58+
make_docker_images:
59+
description: Builds docker images
60+
steps:
61+
- run: make docker-child_chain
62+
- run: make docker-watcher
63+
- run: make docker-watcher_info
64+
65+
install_elixir_and_check_docker_status:
66+
description: Installs elixir and checks if docker is healthy
67+
steps:
68+
- run:
69+
name: Print docker states
70+
command: |
71+
docker image ls
72+
docker-compose ps
73+
- restore_cache:
74+
key: v2-asdf-install
75+
- run:
76+
name: Install Erlang and Elixir
77+
command: |
78+
[ -d ~/.asdf-vm ] || git clone https://github.com/asdf-vm/asdf.git ~/.asdf-vm --branch v0.7.4
79+
echo 'source ~/.asdf-vm/asdf.sh' >> $BASH_ENV
80+
source $BASH_ENV
81+
asdf plugin-add erlang || asdf plugin-update erlang
82+
asdf plugin-add elixir || asdf plugin-update elixir
83+
asdf install
84+
no_output_timeout: 2400
85+
- save_cache:
86+
key: v2-asdf-install
87+
paths:
88+
- ~/.asdf
89+
- ~/.asdf-vm
90+
- run: make install-hex-rebar
91+
- run: sh .circleci/status.sh
92+
- restore_cache:
93+
key: v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
94+
5895
jobs:
5996
barebuild:
6097
executor: metal
@@ -446,40 +483,13 @@ jobs:
446483
name: Setup data dir
447484
command: |
448485
[ -d data ] || mkdir data && chmod 777 data
449-
- run: make docker-child_chain
450-
- run: make docker-watcher
451-
- run: make docker-watcher_info
486+
- make_docker_images
452487
- run:
453488
name: Start daemon services
454489
command: |
455490
cd priv/cabbage
456491
make start_daemon_services-2 || (START_RESULT=$?; docker-compose logs; exit $START_RESULT;)
457-
- run:
458-
name: Print docker states
459-
command: |
460-
docker image ls
461-
docker-compose ps
462-
- restore_cache:
463-
key: v2-asdf-install
464-
- run:
465-
name: Install Erlang and Elixir
466-
command: |
467-
[ -d ~/.asdf-vm ] || git clone https://github.com/asdf-vm/asdf.git ~/.asdf-vm --branch v0.7.4
468-
echo 'source ~/.asdf-vm/asdf.sh' >> $BASH_ENV
469-
source $BASH_ENV
470-
asdf plugin-add erlang || asdf plugin-update erlang
471-
asdf plugin-add elixir || asdf plugin-update elixir
472-
asdf install
473-
no_output_timeout: 2400
474-
- save_cache:
475-
key: v2-asdf-install
476-
paths:
477-
- ~/.asdf
478-
- ~/.asdf-vm
479-
- run: make install-hex-rebar
480-
- run: sh .circleci/status.sh
481-
- restore_cache:
482-
key: v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
492+
- install_elixir_and_check_docker_status
483493
- run:
484494
name: Run specs
485495
command: |
@@ -488,12 +498,6 @@ jobs:
488498
make generate_api_code
489499
mix deps.get
490500
mix test
491-
- run:
492-
name: Run load test
493-
command: |
494-
cd priv/perf
495-
make init
496-
make test
497501
- run:
498502
name: (Cabbage) Format generated code and check for warnings
499503
command: |
@@ -504,9 +508,42 @@ jobs:
504508
mix format apps/watcher_info_api/lib/watcher_info_api/model/*.ex
505509
mix format apps/watcher_security_critical_api/lib/watcher_security_critical_api/model/*.ex
506510
MIX_ENV=test mix do compile --warnings-as-errors --ignore-module-conflict --force, test --exclude test
511+
- save_cache:
512+
key: v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
513+
paths:
514+
- "priv/cabbage/deps"
515+
- run:
516+
name: (Cabbage) Credo and formatting
517+
command: |
518+
cd priv/cabbage
519+
mix do credo, format --check-formatted --dry-run
520+
521+
test_docker_compose_performance:
522+
machine:
523+
image: ubuntu-1604:201903-01
524+
steps:
525+
- checkout
526+
- run:
527+
name: Setup data dir
528+
command: |
529+
[ -d data ] || mkdir data && chmod 777 data
530+
- make_docker_images
531+
- run:
532+
name: Start daemon services
533+
command: |
534+
SNAPSHOT=SNAPSHOT_MIX_EXIT_PERIOD_SECONDS_120 make init_test && docker-compose -f ./docker-compose.yml up -d || (START_RESULT=$?; docker-compose logs; exit $START_RESULT;)
535+
- install_elixir_and_check_docker_status
536+
- run:
537+
name: Run load test
538+
command: |
539+
export $(cat ./localchain_contract_addresses.env | xargs)
540+
cd priv/perf
541+
make init
542+
make test
507543
- run:
508544
name: (Perf) Format generated code and check for warnings
509545
command: |
546+
export $(cat ./localchain_contract_addresses.env | xargs)
510547
cd priv/perf
511548
# run format ONLY on formatted code so that it cleans up quoted atoms because
512549
# we cannot exclude folders to --warnings-as-errors
@@ -515,13 +552,8 @@ jobs:
515552
- save_cache:
516553
key: v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
517554
paths:
518-
- "priv/cabbage/deps"
519555
- "priv/perf/deps"
520-
- run:
521-
name: (Cabbage) Credo and formatting
522-
command: |
523-
cd priv/cabbage
524-
mix do credo, format --check-formatted --dry-run
556+
525557
- run:
526558
name: (Perf) Credo and formatting
527559
command: |
@@ -546,40 +578,13 @@ jobs:
546578
[ -d data1 ] || mkdir data1 && chmod 777 data1
547579
[ -d data2 ] || mkdir data2 && chmod 777 data2
548580
[ -d data ] || mkdir data && chmod 777 data
549-
- run: make docker-child_chain
550-
- run: make docker-watcher
551-
- run: make docker-watcher_info
581+
- make_docker_images
552582
- run:
553583
name: Start daemon services
554584
command: |
555585
cd priv/cabbage
556586
make start_daemon_services_reorg-2 || (START_RESULT=$?; docker-compose logs; exit $START_RESULT;)
557-
- run:
558-
name: Print docker states
559-
command: |
560-
docker image ls
561-
docker-compose ps
562-
- restore_cache:
563-
key: v2-asdf-install
564-
- run:
565-
name: Install Erlang and Elixir
566-
command: |
567-
[ -d ~/.asdf-vm ] || git clone https://github.com/asdf-vm/asdf.git ~/.asdf-vm --branch v0.7.4
568-
echo 'source ~/.asdf-vm/asdf.sh' >> $BASH_ENV
569-
source $BASH_ENV
570-
asdf plugin-add erlang || asdf plugin-update erlang
571-
asdf plugin-add elixir || asdf plugin-update elixir
572-
asdf install
573-
no_output_timeout: 2400
574-
- save_cache:
575-
key: v2-asdf-install
576-
paths:
577-
- ~/.asdf
578-
- ~/.asdf-vm
579-
- run: make install-hex-rebar
580-
- run: sh .circleci/status.sh
581-
- restore_cache:
582-
key: v2-mix-specs-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
587+
- install_elixir_and_check_docker_status
583588
- run:
584589
name: Print watcher logs
585590
command: make cabbage-reorg-watcher-logs
@@ -714,12 +719,6 @@ jobs:
714719
command: |
715720
cd priv/cabbage
716721
mix test
717-
- run:
718-
name: Run load test
719-
command: |
720-
cd priv/perf
721-
make init
722-
make test
723722
724723
publish_child_chain:
725724
machine:
@@ -920,6 +919,9 @@ workflows:
920919
- test_docker_compose_release:
921920
requires: [build]
922921
filters: *all_branches_and_tags
922+
- test_docker_compose_performance:
923+
requires: [build]
924+
filters: *all_branches_and_tags
923925
- test_docker_compose_reorg:
924926
requires: [build]
925927
filters: *all_branches_and_tags

apps/omg_performance/lib/omg_performance/block_creator.ex

Lines changed: 0 additions & 60 deletions
This file was deleted.

apps/omg_performance/lib/omg_performance/http_rpc/watcher_client.ex

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)