본문으로 건너뛰기
Skillpedia
테스트7.0k · #13629

integration-tests

하는 일

이 스킬은 메모리 안이 아니라 실제 환경에서 GenLayer 컨트랙트 테스트를 실행하는 방법을 보여 줍니다. 네트워크를 고르고, 상태를 읽기 전에 각 트랜잭션이 성공했는지 확인하는 테스트를 작성하는 방법을 다룹니다.

사용하는 경우

  • ✓메모리 대신 실제 네트워크에서 GenLayer 컨트랙트를 테스트하고 싶을 때.
  • ✓출시 전에 테스트넷에서 컨트랙트가 작동하는지 확인해야 할 때.
  • ✓트랜잭션은 성공한 것처럼 보이는데 컨트랙트 상태가 잘못된 경우.

스킬 링크

https://github.com/internet-court/internet-court-skill/blob/main/vendored/genlayer/integration-tests/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/internet-court/internet-court-skill/blob/main/vendored/genlayer/integration-tests/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“스튜디오 네트워크에서 제 GenLayer 컨트랙트의 통합 테스트를 실행하고 출력을 보여 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 사용자가 고른 네트워크에 대해 gltest 도구를 실행하고, 컨트랙트를 배포하고 트랜잭션을 보내며 상태를 읽는 테스트를 작성합니다. 컨트랙트를 읽기 전에 각 트랜잭션의 실행 결과를 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Integration Tests

Run contracts against a real GenLayer environment (GLSim, Studio, or testnet) with full consensus validation.

Running Tests

# Against default network (from gltest.config.yaml)
gltest tests/integration/ -v -s

# Against specific network
gltest tests/integration/ -v -s --network localnet
gltest tests/integration/ -v -s --network studionet
gltest tests/integration/ -v -s --network testnet_bradbury

Always use -v -s for visible output during development.

Test Pattern

from gltest import get_contract_factory
from gltest.assertions import tx_execution_succeeded

def test_full_flow():
    factory = get_contract_factory("MyContract")
    contract = factory.deploy(args=[])

    # Write methods return transaction receipts
    tx_receipt = contract.set_data(args=["hello"]).transact()
    assert tx_execution_succeeded(tx_receipt)

    # Read methods return values directly
    result = contract.get_data(args=[contract.address]).call()
    assert result == "hello"

ACCEPTED and FINALIZED are transaction lifecycle states, not proof that contract execution succeeded. A transaction can be accepted and finalized with an execution error, and failed execution applies no state changes. For deploy transactions, failed execution means no contract is created.

Always assert tx_execution_succeeded(receipt) before reading state, checking schema/code, or treating a missing contract as an infrastructure issue.

Key Differences from Direct Mode

Direct Mode Integration Tests
Speed ~30ms ~seconds to minutes
Server required No Yes (GLSim, Studio, or testnet)
Consensus Leader only Full leader + validators
Write methods Return values directly Return transaction receipts
Read methods Return values directly Use .call()
Mocking mock_web() / mock_llm() Real web/LLM calls

Write vs Read Calls

Write methods (state-changing):

# .transact() submits and waits for consensus
tx_receipt = contract.method_name(args=[arg1, arg2]).transact()
assert tx_execution_succeeded(tx_receipt)

Read methods (view-only):

# .call() reads without transaction
result = contract.view_method(args=[arg1]).call()

Configuration (gltest.config.yaml)

contract_path: contracts/

networks:
  localnet:
    # GenLayer Studio running locally
  studionet:
    # studio.genlayer.com — gasless, no funding needed (0 GEN balance is fine)
  testnet_bradbury:
    accounts:
      - "${ACCOUNT_PRIVATE_KEY_1}"
      - "${ACCOUNT_PRIVATE_KEY_2}"

Test Markers

import pytest

@pytest.mark.slow
def test_expensive_operation():
    """Excluded by default. Run with: gltest -m slow"""
    pass

Environments

  • GLSim (pip install genlayer-test[sim], glsim --port 4000 --validators 5) — lightweight, no Docker, ~1s startup. Runs Python natively, not in GenVM. Good for fast iteration.
  • Studio local (genlayer up) — full GenVM, real consensus, Docker required. Validates runtime compatibility.
  • studio.genlayer.com (StudioNet) — hosted Studio, no setup, rate-limited (see Common Issues). Gasless: no tokens required. Accounts with 0 GEN balance can deploy and run tests normally.
  • Testnet Bradbury — real network, requires funded accounts.

When to Use Integration Tests

  • Validating consensus (leader + validators agree)
  • Testing real web requests and LLM calls
  • Pre-deployment smoke tests
  • Verifying contract works in actual GenVM (not just Python runner)

Direct mode should cover most logic testing. Use integration tests for final validation before deploying.

Common Issues

"Transaction not found" errors

Clear cache: rm -rf .gltest_cache

Slow tests

Run single tests during development:

gltest tests/integration/test_file.py::test_specific -v -s

JSON serialization

When working with mock validators, convert to dicts:

transaction_context = {"validators": [v.to_dict() for v in mock_validators]}

Studio rate limits (HTTP 429 / -32429)

studio.genlayer.com enforces per-IP limits: 60 req/min, 1000 req/hr, 10000 req/day. Limits aren't permanent — once tripped, further requests are rejected until the current window resets (next minute / hour / day cycle). Throttle batch tests, run heavy suites against localnet (GLSim or local Studio), or pace .transact() calls.

-32028 is the related pending-queue cap — **up to 32 in-flight

자주 묻는 질문

accepted로 표시된 트랜잭션도 왜 확인해야 하나요?

스킬은 accepted와 finalized는 트랜잭션의 생명 주기만 설명한다고 말합니다. 트랜잭션이 실행 오류로 끝날 수 있으므로 실행 결과를 확인해야 합니다.

어떤 네트워크에서 테스트할 수 있나요?

localnet, studionet, testnet Bradbury가 나열되어 있으며, 기본값은 프로젝트 설정 파일에서 옵니다.

상세 출력 플래그는 왜 쓰나요?

개발 중에 출력을 볼 수 있도록 스킬이 권장합니다.

상세 정보

작성자의 원본 설명

Write and run integration tests against a GenLayer environment.

repo: internet-court/internet-court-skill

인기도

GitHub 스타
7.0k
순위
#13629
라이선스
—
업데이트
2026. 10. 26.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬