Skip to content

Commit

Permalink
Merge pull request #103 from smartcontractkit/keeper_soak
Browse files Browse the repository at this point in the history
Keeper soak test
  • Loading branch information
skudasov authored Oct 5, 2021
2 parents 9965cc9 + e2af942 commit d22e314
Show file tree
Hide file tree
Showing 5 changed files with 467 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ test_ocr: ## run ocr tests
test_ocr_soak: ## run OCR soak test
NETWORK="ethereum_geth_performance" ginkgo -r --focus="@soak-ocr"

.PHONY: test_keeper_soak
test_keeper_soak: ## run Keeper soak/performance test
NETWORK="ethereum_geth_performance" ginkgo -r --focus="@performance-keeper"

.PHONY: test_vrf_soak
test_vrf_soak: ## run VRF soak test
NETWORK="ethereum_geth_performance" ginkgo -r --focus="@soak-vrf"
Expand Down
3 changes: 2 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,5 @@ contracts:
commit: 19ba7cfbe7b7c6ca7621b090e229b4ba1147e2e1
ocr:
path: ocr/artifacts/contract/src
commit: f27c14a905c5735abbb6e0c9699e9d0e3e9b7217
commit: f27c14a905c5735abbb6e0c9699e9d0e3e9b7217

57 changes: 57 additions & 0 deletions contracts/ethereum_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,63 @@ func (o *OffchainAggregatorRoundConfirmer) Wait() error {
}
}

// KeeperConsumerRoundConfirmer is a header subscription that awaits for a round of upkeeps
type KeeperConsumerRoundConfirmer struct {
instance KeeperConsumer
upkeepsValue int
doneChan chan struct{}
context context.Context
cancel context.CancelFunc
}

// NewKeeperConsumerRoundConfirmer provides a new instance of a KeeperConsumerRoundConfirmer
func NewKeeperConsumerRoundConfirmer(
contract KeeperConsumer,
counterValue int,
timeout time.Duration,
) *KeeperConsumerRoundConfirmer {
ctx, ctxCancel := context.WithTimeout(context.Background(), timeout)
return &KeeperConsumerRoundConfirmer{
instance: contract,
upkeepsValue: counterValue,
doneChan: make(chan struct{}),
context: ctx,
cancel: ctxCancel,
}
}

// ReceiveBlock will query the latest Keeper round and check to see whether the round has confirmed
func (o *KeeperConsumerRoundConfirmer) ReceiveBlock(_ client.NodeBlock) error {
upkeeps, err := o.instance.Counter(context.Background())
if err != nil {
return err
}
l := log.Info().
Str("Contract Address", o.instance.Address()).
Int64("Upkeeps", upkeeps.Int64()).
Int("Required upkeeps", o.upkeepsValue)
if upkeeps.Int64() == int64(o.upkeepsValue) {
l.Msg("Upkeep completed")
o.doneChan <- struct{}{}
} else {
l.Msg("Waiting for upkeep round")
}
return nil
}

// Wait is a blocking function that will wait until the round has confirmed, and timeout if the deadline has passed
func (o *KeeperConsumerRoundConfirmer) Wait() error {
for {
select {
case <-o.doneChan:
o.cancel()
return nil
case <-o.context.Done():
return fmt.Errorf("timeout waiting for upkeeps to confirm: %d", o.upkeepsValue)
}
}
}

// EthereumStorage acts as a conduit for the ethereum version of the storage contract
type EthereumStorage struct {
client *client.EthereumClient
Expand Down
Loading

2 comments on commit d22e314

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

14.69%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
client
   chainlink.go66.19%100%100%66.19%100–104, 108–113, 148–153, 250–255, 258–263, 290–292, 299–300, 307–308, 311–317, 319–325, 327–328, 338–339, 349–351, 367–368, 379–380, 384–390, 392, 394, 396–402, 409–415, 428–429, 79–81, 94–99
   explorer.go0%100%100%0%15–20, 24–35
   prometheus.go0%100%100%0%102–107, 111–116, 32–41, 44–47, 50–55, 59–70, 74–85, 89–98
   chainlink_models.go0%100%100%0%240, 243–251, 260–262, 265–271, 279–281, 284–303, 312–314, 317–335, 346, 349–360, 378, 381–402, 412, 415–422, 439, 442–462, 489, 492–503, 505–559, 573, 576–589, 597, 600–607, 610–615, 618–623
   gas_stats.go0%100%100%0%34–40, 43–46, 49–53, 55–62, 65–70, 74–88
   basic_http_client.go10.61%100%100%10.61%100–110, 42–47, 55–67, 69–74, 76–96, 98–99
   blockchain.go37.90%100%100%37.90%103–107, 113–117, 120–126, 131–133, 136–138, 141–143, 146–148, 151–153, 156–158, 161–163, 176–180, 199–201, 209–214, 220–221, 242–243, 251–253, 256–258, 265–266, 271–272, 284–285, 52–57, 59, 97–98
   ethereum.go0%100%100%0%100, 105–108, 112–116, 118, 122–125, 129–132, 136–142, 144, 164–166, 169–171, 174–176, 179–184, 188–190, 193–198, 202–207, 211–216, 228–232, 234–248, 252–261, 263–264, 268–272, 275–280, 284–286, 289–299, 301–302, 304–308, 313–315, 318–330, 334–336, 341–343, 350–364, 368–389, 391, 40, 401–409, 41, 410–414, 416–419, 42, 420–430, 434–440, 442–448, 45, 450, 458–459, 46, 460–469, 47, 470–476, 485–498, 50, 507–509, 51, 510–519, 52, 520–529, 53, 530–531, 535–539, 54, 540–545, 547, 55, 551–559, 563–567, 570–574, 576–583, 585, 587, 59, 590–599, 60, 600–607, 61, 612–619, 62, 620–624, 626–629, 63, 630–631, 633–635, 638–639, 64, 640–662, 665, 673–679, 68, 680–689, 69, 690–694, 70, 710–722, 726–729, 73, 730–739, 74, 740–748, 75, 752–759, 768–770, 773–775, 78–80, 83–85, 88–90, 93–95, 98–99
   mockserver.go0%100%100%0%20–25, 28–31, 34–37
config
   config.go92.86%100%100%92.86%210–211
environment
   k8s_environment.go0%100%100%0%100, 1000–1001, 1003, 1007–1009, 101, 1010–1019, 102, 1020, 1023–1027, 103, 1031–1032, 1038–1039, 104, 1040–1049, 105, 1050–1054, 1057–1059, 106, 1060–1063, 1066, 1069, 107, 1070–1076, 108, 1080–1087, 1089, 109, 1099, 110, 1100–1104, 1106–1109, 111, 1110–1113, 1115, 1119, 112, 1120–1123, 1125, 1128–1129, 113, 1130–1132, 1135–1139, 114, 1141–1149, 115, 1150–1153, 1156–1158, 116, 1161–1169, 117, 1170–1178, 118, 1183, 119–122, 124–139, 143–164, 166–167, 171, 175–179, 183–192, 194–197, 199–202, 206–211, 216–222, 225–231, 233–240, 245–250, 254–258, 262–266, 271–275, 278–280, 284–290, 293–300, 302–304, 307, 311–338, 342–347, 351–356, 358–362, 364–372, 374–379, 381, 384–400, 402, 405–421, 465–468, 472–474, 477–479, 482–484, 487–500, 505–525, 529–531, 533–535, 537–548, 551–554, 558–572, 574, 578–586, 588–593, 596–599, 601–618, 620–629, 633–635, 638–642, 645–650, 652–664, 666, 671–684, 686–698, 700, 703–708, 710–722, 724, 727–740, 742, 749–754, 756, 763–772, 774, 781–790, 792, 799–808, 810, 817–824, 826–838, 840–844, 848–855, 867–874, 877–884, 887–890, 892–896, 898–912, 915–919, 921–934, 936–938, 940–949, 95, 952–959, 96, 960, 963–965, 97–98, 983–985, 988–989, 99, 992–994, 997–999
   k8s_helm_resource.go0%100%100%0%100–111, 113, 117–128, 130, 133–135, 138–153, 156, 160–165, 167–170, 172–186, 188–203, 55–64, 68–70, 73–75, 78–80, 83–85, 88–91, 93–99
   environment_templates.go33.80%100%100%33.80%104–123, 129–144, 146–153, 155–166, 168–169, 175–187, 208–211, 217–232, 236–255, 260–278, 312–331, 333–343, 360–364, 374–375, 397–411, 413–414, 420–425, 427–435, 438–440, 442, 45, 455–456, 46–47, 471–476, 479, 48, 480–481, 49, 491–499, 50, 500–509, 51, 510, 512–514, 516–519, 52, 520, 53, 534–539, 54, 540–545, 549, 55, 550–558, 92–99
   environment.go5.93%100%100%5.93%101, 120–122, 125–127, 130–139, 142–155, 160–168, 174–184, 186, 191–213, 221–226, 43–49, 52–57, 61–66, 70–78, 82–99

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage for this commit

14.69%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
client
   prometheus.go0%100%100%0%102–107, 111–116, 32–41, 44–47, 50–55, 59–70, 74–85, 89–98
   blockchain.go37.90%100%100%37.90%103–107, 113–117, 120–126, 131–133, 136–138, 141–143, 146–148, 151–153, 156–158, 161–163, 176–180, 199–201, 209–214, 220–221, 242–243, 251–253, 256–258, 265–266, 271–272, 284–285, 52–57, 59, 97–98
   basic_http_client.go10.61%100%100%10.61%100–110, 42–47, 55–67, 69–74, 76–96, 98–99
   explorer.go0%100%100%0%15–20, 24–35
   mockserver.go0%100%100%0%20–25, 28–31, 34–37
   chainlink_models.go0%100%100%0%240, 243–251, 260–262, 265–271, 279–281, 284–303, 312–314, 317–335, 346, 349–360, 378, 381–402, 412, 415–422, 439, 442–462, 489, 492–503, 505–559, 573, 576–589, 597, 600–607, 610–615, 618–623
   gas_stats.go0%100%100%0%34–40, 43–46, 49–53, 55–62, 65–70, 74–88
   chainlink.go66.19%100%100%66.19%100–104, 108–113, 148–153, 250–255, 258–263, 290–292, 299–300, 307–308, 311–317, 319–325, 327–328, 338–339, 349–351, 367–368, 379–380, 384–390, 392, 394, 396–402, 409–415, 428–429, 79–81, 94–99
   ethereum.go0%100%100%0%100, 105–108, 112–116, 118, 122–125, 129–132, 136–142, 144, 164–166, 169–171, 174–176, 179–184, 188–190, 193–198, 202–207, 211–216, 228–232, 234–248, 252–261, 263–264, 268–272, 275–280, 284–286, 289–299, 301–302, 304–308, 313–315, 318–330, 334–336, 341–343, 350–364, 368–389, 391, 40, 401–409, 41, 410–414, 416–419, 42, 420–430, 434–440, 442–448, 45, 450, 458–459, 46, 460–469, 47, 470–476, 485–498, 50, 507–509, 51, 510–519, 52, 520–529, 53, 530–531, 535–539, 54, 540–545, 547, 55, 551–559, 563–567, 570–574, 576–583, 585, 587, 59, 590–599, 60, 600–607, 61, 612–619, 62, 620–624, 626–629, 63, 630–631, 633–635, 638–639, 64, 640–662, 665, 673–679, 68, 680–689, 69, 690–694, 70, 710–722, 726–729, 73, 730–739, 74, 740–748, 75, 752–759, 768–770, 773–775, 78–80, 83–85, 88–90, 93–95, 98–99
config
   config.go92.86%100%100%92.86%210–211
environment
   k8s_environment.go0%100%100%0%100, 1000–1001, 1003, 1007–1009, 101, 1010–1019, 102, 1020, 1023–1027, 103, 1031–1032, 1038–1039, 104, 1040–1049, 105, 1050–1054, 1057–1059, 106, 1060–1063, 1066, 1069, 107, 1070–1076, 108, 1080–1087, 1089, 109, 1099, 110, 1100–1104, 1106–1109, 111, 1110–1113, 1115, 1119, 112, 1120–1123, 1125, 1128–1129, 113, 1130–1132, 1135–1139, 114, 1141–1149, 115, 1150–1153, 1156–1158, 116, 1161–1169, 117, 1170–1178, 118, 1183, 119–122, 124–139, 143–164, 166–167, 171, 175–179, 183–192, 194–197, 199–202, 206–211, 216–222, 225–231, 233–240, 245–250, 254–258, 262–266, 271–275, 278–280, 284–290, 293–300, 302–304, 307, 311–338, 342–347, 351–356, 358–362, 364–372, 374–379, 381, 384–400, 402, 405–421, 465–468, 472–474, 477–479, 482–484, 487–500, 505–525, 529–531, 533–535, 537–548, 551–554, 558–572, 574, 578–586, 588–593, 596–599, 601–618, 620–629, 633–635, 638–642, 645–650, 652–664, 666, 671–684, 686–698, 700, 703–708, 710–722, 724, 727–740, 742, 749–754, 756, 763–772, 774, 781–790, 792, 799–808, 810, 817–824, 826–838, 840–844, 848–855, 867–874, 877–884, 887–890, 892–896, 898–912, 915–919, 921–934, 936–938, 940–949, 95, 952–959, 96, 960, 963–965, 97–98, 983–985, 988–989, 99, 992–994, 997–999
   environment_templates.go33.80%100%100%33.80%104–123, 129–144, 146–153, 155–166, 168–169, 175–187, 208–211, 217–232, 236–255, 260–278, 312–331, 333–343, 360–364, 374–375, 397–411, 413–414, 420–425, 427–435, 438–440, 442, 45, 455–456, 46–47, 471–476, 479, 48, 480–481, 49, 491–499, 50, 500–509, 51, 510, 512–514, 516–519, 52, 520, 53, 534–539, 54, 540–545, 549, 55, 550–558, 92–99
   environment.go5.93%100%100%5.93%101, 120–122, 125–127, 130–139, 142–155, 160–168, 174–184, 186, 191–213, 221–226, 43–49, 52–57, 61–66, 70–78, 82–99
   k8s_helm_resource.go0%100%100%0%100–111, 113, 117–128, 130, 133–135, 138–153, 156, 160–165, 167–170, 172–186, 188–203, 55–64, 68–70, 73–75, 78–80, 83–85, 88–91, 93–99

Please sign in to comment.