Skip to content

Commit

Permalink
feat(feature-activation): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glevco committed Jun 5, 2023
1 parent 5389765 commit 424a933
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
7 changes: 0 additions & 7 deletions hathor/conf/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,3 @@ FEATURE_ACTIVATION:
evaluation_interval: 4
max_signal_bits: 4
default_threshold: 3
features:
NOP_FEATURE_1:
bit: 0
start_height: 20
timeout_height: 60
activate_on_timeout: true
version: 0.0.0
21 changes: 20 additions & 1 deletion tests/feature_activation/test_feature_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,31 @@
from unittest.mock import Mock, patch

from hathor.feature_activation import feature_service
from hathor.feature_activation.feature import Feature
from hathor.feature_activation.model.criteria import Criteria
from hathor.feature_activation.resources.feature import FeatureResource
from hathor.feature_activation.settings import Settings as FeatureSettings
from hathor.p2p.peer_id import PeerId
from hathor.simulator.trigger import StopAfterNMinedBlocks
from tests import unittest
from tests.resources.base_resource import StubSite
from tests.simulation.base import SimulatorTestCase

_FEATURE_SETTINGS = FeatureSettings(
evaluation_interval=4,
max_signal_bits=4,
default_threshold=3,
features={
Feature.NOP_FEATURE_1: Criteria(
bit=0,
start_height=20,
timeout_height=60,
activate_on_timeout=True,
version='0.0.0'
)
}
)


class BaseTestFeatureSimulation(SimulatorTestCase):
seed_config = 5604003716498505253
Expand All @@ -35,8 +53,9 @@ def setUp(self):
manager.allow_mining_without_peers()

self.feature_service = artifacts.feature_service
self.feature_service._feature_settings = _FEATURE_SETTINGS
feature_resource = FeatureResource(
feature_settings=self.simulator.settings.FEATURE_ACTIVATION,
feature_settings=_FEATURE_SETTINGS,
feature_service=self.feature_service,
tx_storage=manager.tx_storage
)
Expand Down

0 comments on commit 424a933

Please sign in to comment.