Skip to content

Commit 6baae0a

Browse files
committed
fix: program >4 compute unit should not be rejected
1 parent a6f0d09 commit 6baae0a

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

src/aleph_client/commands/program.py

-7
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,6 @@ async def upload(
182182
verbose=verbose,
183183
),
184184
)
185-
if (tier.compute_units > 4) and payment.type == PaymentType.hold:
186-
console.print(
187-
"Programs using more than 4 Compute Units require PAYG, which is not yet available. Please use HOLD "
188-
"for programs with up to 4 Compute Units.",
189-
style="red",
190-
)
191-
raise typer.Exit(code=1)
192185

193186
name = name or validated_prompt("Program name", lambda x: x and len(x) < 65)
194187
vcpus = tier.vcpus

tests/unit/test_program.py

-34
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import aiohttp
99
import pytest
10-
import typer
1110
from aleph.sdk.conf import settings
1211
from aleph_message.models import Chain
1312

@@ -191,39 +190,6 @@ async def upload_program():
191190
await upload_program()
192191

193192

194-
@pytest.mark.asyncio
195-
async def test_upload_program_reject():
196-
mock_load_account = create_mock_load_account()
197-
mock_account = mock_load_account.return_value
198-
mock_auth_client_class, mock_auth_client = create_mock_auth_client(mock_account)
199-
mock_get_balance = AsyncMock(return_value={"available_amount": 100000})
200-
201-
@patch("aleph_client.commands.program._load_account", mock_load_account)
202-
@patch("aleph_client.utils.os.path.isfile", MagicMock(return_value=True))
203-
@patch("aleph_client.commands.program.AuthenticatedAlephHttpClient", mock_auth_client_class)
204-
@patch("aleph_client.commands.program.get_balance", mock_get_balance)
205-
@patch("aleph_client.commands.program.open", MagicMock())
206-
async def upload_program():
207-
print() # For better display when pytest -v -s
208-
with pytest.raises(typer.Exit) as exc_info:
209-
await upload(
210-
address=FAKE_ADDRESS_EVM,
211-
path=Path("/fake/file.squashfs"),
212-
entrypoint="main:app",
213-
name="mock_program",
214-
runtime=settings.DEFAULT_RUNTIME_ID,
215-
compute_units=6, # Program with more than 4 compute unit should return an error
216-
updatable=True,
217-
skip_volume=True,
218-
skip_env_var=True,
219-
)
220-
mock_load_account.assert_called_once()
221-
mock_auth_client.create_program.assert_called_once()
222-
assert exc_info.value.exit_code == 1
223-
224-
await upload_program()
225-
226-
227193
@pytest.mark.asyncio
228194
async def test_update_program():
229195
mock_load_account = create_mock_load_account()

0 commit comments

Comments
 (0)