Skip to content

Commit

Permalink
Problem: test-env build failed (#1114)
Browse files Browse the repository at this point in the history
* fix testenv

* update pystarport

* fix nix lint

* fix create_validator, use old solomachine

* fix solomachine

* skip sign offline test case

* Update nix/testenv.nix

Signed-off-by: yihuang <[email protected]>

* fix upgrade

---------

Signed-off-by: yihuang <[email protected]>
Co-authored-by: mmsqe <[email protected]>
  • Loading branch information
yihuang and mmsqe authored Feb 5, 2025
1 parent d42e5a3 commit c6658f1
Show file tree
Hide file tree
Showing 8 changed files with 743 additions and 747 deletions.
1,361 changes: 682 additions & 679 deletions integration_tests/poetry.lock

Large diffs are not rendered by default.

37 changes: 16 additions & 21 deletions integration_tests/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@ description = ""
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.8"
pytest = "^7.1.3"
pytest-xdist = "^2.5.0"
flake8 = "^4.0.1"
black = "^22.6"
flake8-black = "^0.3.3"
flake8-isort = "^4.1.1"
grpcio = "^1.53.0"
grpcio-tools = "^1.42.0"
pep8-naming = "^0.11.1"
pytest-github-actions-annotate-failures = "^0.1.7"
protobuf = "^3.20.2"
pyyaml = "^6.0.1"
python-dateutil = "^2.8.1"
pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main" }
chainlibpy = "^2.2.0"

# manually upgrade to make hatchling build success in poetry2nix
pathspec = "^0.10.1"
python = "^3.9"
pytest = "^8.0"
pytest-xdist = "^3.5"
flake8 = "^7.0"
black = "^24.3"
flake8-black = "^0.3"
flake8-isort = "^6.1"
pep8-naming = "^0.13"
pytest-github-actions-annotate-failures = "^0.2"
protobuf = "^4.25"
pyyaml = "^6.0.2rc1"
python-dateutil = "^2.8"
pystarport = { git = "https://github.com/yihuang/pystarport.git", branch = "main" }
grpcio = ">=1.42.0,<2.0.0"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
4 changes: 4 additions & 0 deletions integration_tests/test_sign_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def get_network_config(grpc_port, chain_id):
)


# FIXME
@pytest.mark.skip(
reason="chainlibpy is not maintained, need to refactor this test case"
)
def test_sign_offline(cluster):
"""
check simple transfer tx success
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_join_validator(cluster):
# wait for the new node to sync
wait_for_block(cluster.cosmos_cli(i), cluster.block_height(0))
# create validator tx
assert cluster.create_validator("1cro", i)["code"] == 0
assert cluster.create_validator_legacy("1cro", i)["code"] == 0
time.sleep(2)

count2 = len(cluster.validators())
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def cosmovisor_cluster(worker_index, pytestconfig, tmp_path_factory):
worker_index,
data,
post_init=post_init,
cmd=(data / "cosmovisor/genesis/bin/chain-maind"),
cmd=str(data / "cosmovisor/genesis/bin/chain-maind"),
)


Expand Down
6 changes: 2 additions & 4 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ import sources.nixpkgs {
${pkgs.test-env}/bin/flake8 --show-source --count --statistics \
--format="::error file=%(path)s,line=%(row)d,col=%(col)d::%(path)s:%(row)d:%(col)d: %(code)s %(text)s" \
|| EXIT_STATUS=$?
find . -name "*.nix" -type f | xargs ${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check || EXIT_STATUS=$?
find . -name "*.nix" -type f | xargs ${pkgs.nixfmt-rfc-style}/bin/nixfmt -c || EXIT_STATUS=$?
exit $EXIT_STATUS
'';
chain-maind-zemu = pkgs.callPackage ../. {
ledger_zemu = true;
};
chain-maind-zemu = pkgs.callPackage ../. { ledger_zemu = true; };
# chain-maind for integration test
chain-maind-test = pkgs.callPackage ../. {
ledger_zemu = true;
Expand Down
22 changes: 11 additions & 11 deletions nix/solomachine.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{ fetchFromGitHub
, lib
, stdenv
, darwin
, rustPlatform
, protobuf
, rustfmt
,
{
fetchFromGitHub,
lib,
stdenv,
darwin,
rustPlatform,
protobuf,
rustfmt,
}:
rustPlatform.buildRustPackage rec {
pname = "ibc-solo-machine";
version = "0.1.4";
version = "0.1.2";

src = fetchFromGitHub {
owner = "crypto-com";
repo = pname;
rev = "v${version}";
sha256 = "sha256-+jfRbPm31/pBuseUS89cuYSAPw2l/509MVTaUcuyaGY=";
sha256 = "sha256-9eUyljX0Sh/jbM7uiNo78vUevnTBP/MxvpDiiJLZ8Hk=";
};

cargoSha256 = "sha256-9Mx70yBoNy711PFC5y2VoXD3kqmcMvDsjP9AaC1VfCM=";
cargoSha256 = "sha256-cuDc8h0Hb6fiizvhMKe3v2nPXkaIXx+1mgCH68KsB4g=";
cargoBuildFlags = "-p solo-machine -p mnemonic-signer";
nativeBuildInputs = [
protobuf
Expand Down
56 changes: 26 additions & 30 deletions nix/testenv.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
{
poetry2nix,
python39,
python311,
lib,
}:
poetry2nix.mkPoetryEnv {
python = python39;
python = python311;
preferWheels = true;
projectDir = ../integration_tests;
overrides = poetry2nix.overrides.withDefaults (
lib.composeManyExtensions [
(
self: super:
let
buildSystems = {
pyparsing = [ "flit-core" ];
hdwallets = [ "poetry" ];
pystarport = [ "poetry" ];
durations = [ "setuptools" ];
multitail2 = [ "setuptools" ];
pytest-github-actions-annotate-failures = [ "setuptools" ];
flake8-black = [ "setuptools" ];
};
in
lib.mapAttrs (
attr: systems:
super.${attr}.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
})
) buildSystems
)
(self: super: {
pyyaml-include = super.pyyaml-include.overridePythonAttrs {
preConfigure = ''
substituteInPlace setup.py --replace "setup()" "setup(version=\"1.3\")"
'';
};
self: super:
let
buildSystems = {
pystarport = [ "poetry-core" ];
hdwallets = [ "poetry" ];
durations = [ "setuptools" ];
multitail2 = [ "setuptools" ];
pytest-github-actions-annotate-failures = [ "setuptools" ];
flake8-black = [ "setuptools" ];
flake8-isort = [ "hatchling" ];
docker = [
"hatchling"
"hatch-vcs"
];
click = [ "flit-core" ];
isort = [ "hatchling" ];
};
in
lib.mapAttrs (
attr: systems:
super.${attr}.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
})
]
) buildSystems
);
}

0 comments on commit c6658f1

Please sign in to comment.