Cesar Rodas 3 mesiacov pred
rodič
commit
2efa7e5816
3 zmenil súbory, kde vykonal 32 pridanie a 67 odobranie
  1. 17 57
      .github/workflows/ci.yml
  2. 14 10
      crates/cdk-ffi/tests/test_transactions.py
  3. 1 0
      flake.nix

+ 17 - 57
.github/workflows/ci.yml

@@ -6,7 +6,7 @@ on:
   pull_request:
     branches:
       - main
-      - 'v[0-9]*.[0-9]*.x'  # Match version branches like v0.13.x, v1.0.x, etc.
+      - "v[0-9]*.[0-9]*.x" # Match version branches like v0.13.x, v1.0.x, etc.
   release:
     types: [created]
 
@@ -48,14 +48,7 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        build-args:
-          [
-            mint-token,
-            melt-token,
-            p2pk,
-            proof-selection,
-            wallet
-          ]
+        build-args: [mint-token, melt-token, p2pk, proof-selection, wallet]
     steps:
       - name: checkout
         uses: actions/checkout@v4
@@ -84,8 +77,7 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        build-args:
-          [
+        build-args: [
             # Core crate testing
             -p cashu,
             -p cashu --no-default-features,
@@ -105,18 +97,18 @@ jobs:
             -p cdk-sql-common,
             -p cdk-sql-common --no-default-features --features wallet,
             -p cdk-sql-common --no-default-features --features mint,
-            
+
             # Database and infrastructure crates
             -p cdk-redb,
             -p cdk-sqlite,
             -p cdk-sqlite --features sqlcipher,
-            
+
             # HTTP/API layer - consolidated
             -p cdk-axum,
             -p cdk-axum --no-default-features,
             -p cdk-axum --no-default-features --features redis,
             -p cdk-axum --no-default-features --features "redis swagger",
-            
+
             # Lightning backends
             -p cdk-cln,
             -p cdk-lnd,
@@ -124,12 +116,12 @@ jobs:
             -p cdk-fake-wallet,
             -p cdk-payment-processor,
             -p cdk-ldk-node,
-            
+
             -p cdk-signatory,
             -p cdk-mint-rpc,
 
             -p cdk-prometheus,
-            
+
             # FFI bindings
             -p cdk-ffi,
             -p cdk-ffi --no-default-features,
@@ -187,15 +179,8 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        build-args:
-          [
-            -p cdk-integration-tests,
-          ]
-        database:
-          [
-            SQLITE,
-            POSTGRES
-          ]
+        build-args: [-p cdk-integration-tests]
+        database: [SQLITE, POSTGRES]
     steps:
       - name: checkout
         uses: actions/checkout@v4
@@ -234,14 +219,8 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        build-args:
-          [
-            -p cdk-integration-tests,
-          ]
-        database:
-          [
-          SQLITE,
-          ]
+        build-args: [-p cdk-integration-tests]
+        database: [SQLITE]
     steps:
       - name: checkout
         uses: actions/checkout@v4
@@ -282,12 +261,7 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        database:
-          [
-          memory,
-          sqlite,
-          redb
-          ]
+        database: [memory, sqlite, redb]
     steps:
       - name: checkout
         uses: actions/checkout@v4
@@ -322,7 +296,6 @@ jobs:
       - name: Test mint
         run: nix develop -i -L .#stable --command just test
 
-
   payment-processor-itests:
     name: "Payment processor tests"
     runs-on: ubuntu-latest
@@ -331,12 +304,7 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        ln:
-          [
-          FAKEWALLET,
-          CLN,
-          LND
-          ]
+        ln: [FAKEWALLET, CLN, LND]
     steps:
       - name: checkout
         uses: actions/checkout@v4
@@ -375,8 +343,7 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        build-args:
-          [
+        build-args: [
             # Core library - all features EXCEPT swagger (which breaks MSRV)
             '-p cdk --features "mint,wallet,auth,nostr,bip353,tor,prometheus"',
 
@@ -456,10 +423,7 @@ jobs:
     strategy:
       fail-fast: true
       matrix:
-        database:
-          [
-          SQLITE,
-          ]
+        database: [SQLITE]
     steps:
       - name: checkout
         uses: actions/checkout@v4
@@ -560,9 +524,5 @@ jobs:
         uses: Swatinem/rust-cache@v2
         with:
           shared-key: "stable-${{ steps.flake-hash.outputs.hash }}"
-      - name: Setup Python
-        uses: actions/setup-python@v5
-        with:
-          python-version: '3.11'
       - name: Run FFI tests
-        run: nix develop -i -L .#stable --command just ffi-test
+        run: nix develop -i -L .#integration --command just ffi-test

+ 14 - 10
crates/cdk-ffi/tests/test_transactions.py

@@ -41,9 +41,9 @@ async def test_wallet_creation():
         db = cdk_ffi.create_wallet_db(backend)
         print("✓ Wallet database created")
 
-        # Verify database is accessible
-        mints = await db.get_mints()
-        assert isinstance(mints, dict), "get_mints should return a dict"
+        # Verify database is accessible by querying quotes
+        mint_quotes = await db.get_mint_quotes()
+        assert isinstance(mint_quotes, list), "get_mint_quotes should return a list"
         print("✓ Wallet database accessible")
 
         print("✓ Test passed: Wallet creation works")
@@ -70,14 +70,18 @@ async def test_wallet_mint_management():
         await db.add_mint(mint_url, None)
         print("✓ Added mint to wallet")
 
-        # Query mints
-        mints = await db.get_mints()
-        assert len(mints) > 0, "Should have at least one mint"
-        print(f"✓ Retrieved {len(mints)} mint(s)")
-
-        # Get specific mint
+        # Get specific mint (verifies it was added)
         await db.get_mint(mint_url)
-        print("✓ Retrieved specific mint")
+        print("✓ Retrieved mint from database")
+
+        # Remove mint
+        await db.remove_mint(mint_url)
+        print("✓ Removed mint from wallet")
+
+        # Verify removal
+        mint_info_after = await db.get_mint(mint_url)
+        assert mint_info_after is None, "Mint should be removed"
+        print("✓ Verified mint removal")
 
         print("✓ Test passed: Mint management works")
 

+ 1 - 0
flake.nix

@@ -236,6 +236,7 @@
                 buildInputs = buildInputs ++ [
                   stable_toolchain
                   pkgs.docker-client
+                  pkgs.python311
                 ];
                 inherit nativeBuildInputs;
               }