|
34 | 34 | flagMode = flag.String("mode", "direct", "Connection mode: direct, relay, or dht") |
35 | 35 |
|
36 | 36 | // Additional flags for comprehensive method testing |
37 | | - flagAccount = flag.String("account", "", "Blockchain account address for account-related tests") |
38 | | - flagPoolID = flag.Int("pool-id", 1, "Pool ID for pool-related tests (default: 1)") |
39 | | - flagChain = flag.String("chain", "", "Chain name for chain-specific pool operations") |
40 | | - flagEnableWrite = flag.Bool("enable-write", false, "Enable write/mutation operations (account create, pool join, etc.)") |
| 37 | + flagEnableWrite = flag.Bool("enable-write", false, "Enable write/mutation operations (plugin install, etc.)") |
41 | 38 | flagDestructive = flag.Bool("destructive", false, "Enable destructive operations (reboot, partition, erase, etc.)") |
42 | 39 | flagWifiName = flag.String("wifi-name", "", "WiFi connection name for wifi tests") |
43 | 40 | flagPluginName = flag.String("plugin-name", "", "Plugin name for plugin tests") |
@@ -304,91 +301,6 @@ func TestRealDeviceConnection(t *testing.T) { |
304 | 301 | } |
305 | 302 | }) |
306 | 303 |
|
307 | | - // ---- Account (read-only) ---- |
308 | | - |
309 | | - t.Run("GetAccount", func(t *testing.T) { |
310 | | - result, err := client.GetAccount() |
311 | | - if err != nil { |
312 | | - t.Errorf("GetAccount failed: %v", err) |
313 | | - } else { |
314 | | - t.Logf("GetAccount: %s", string(result)) |
315 | | - } |
316 | | - }) |
317 | | - |
318 | | - t.Run("AccountExists", func(t *testing.T) { |
319 | | - if *flagAccount == "" { |
320 | | - t.Skip("Skipped: pass -account to run AccountExists test") |
321 | | - } |
322 | | - result, err := client.AccountExists(*flagAccount) |
323 | | - if err != nil { |
324 | | - t.Errorf("AccountExists failed: %v", err) |
325 | | - } else { |
326 | | - t.Logf("AccountExists(%s): %s", *flagAccount, string(result)) |
327 | | - } |
328 | | - }) |
329 | | - |
330 | | - t.Run("AccountBalance", func(t *testing.T) { |
331 | | - if *flagAccount == "" { |
332 | | - t.Skip("Skipped: pass -account to run AccountBalance test") |
333 | | - } |
334 | | - result, err := client.AccountBalance(*flagAccount) |
335 | | - if err != nil { |
336 | | - t.Errorf("AccountBalance failed: %v", err) |
337 | | - } else { |
338 | | - t.Logf("AccountBalance(%s): %s", *flagAccount, string(result)) |
339 | | - } |
340 | | - }) |
341 | | - |
342 | | - t.Run("AssetsBalance", func(t *testing.T) { |
343 | | - if *flagAccount == "" { |
344 | | - t.Skip("Skipped: pass -account to run AssetsBalance test") |
345 | | - } |
346 | | - result, err := client.AssetsBalance(*flagAccount, 0, 0) |
347 | | - if err != nil { |
348 | | - t.Errorf("AssetsBalance failed: %v", err) |
349 | | - } else { |
350 | | - t.Logf("AssetsBalance(%s, 0, 0): %s", *flagAccount, string(result)) |
351 | | - } |
352 | | - }) |
353 | | - |
354 | | - // ---- Pool (read-only) ---- |
355 | | - |
356 | | - t.Run("PoolList", func(t *testing.T) { |
357 | | - result, err := client.PoolList() |
358 | | - if err != nil { |
359 | | - t.Errorf("PoolList failed: %v", err) |
360 | | - } else { |
361 | | - t.Logf("PoolList: %s", string(result)) |
362 | | - } |
363 | | - }) |
364 | | - |
365 | | - t.Run("PoolUserList", func(t *testing.T) { |
366 | | - result, err := client.PoolUserList(*flagPoolID) |
367 | | - if err != nil { |
368 | | - t.Errorf("PoolUserList failed: %v", err) |
369 | | - } else { |
370 | | - t.Logf("PoolUserList(%d): %s", *flagPoolID, string(result)) |
371 | | - } |
372 | | - }) |
373 | | - |
374 | | - t.Run("PoolRequests", func(t *testing.T) { |
375 | | - result, err := client.PoolRequests(*flagPoolID) |
376 | | - if err != nil { |
377 | | - t.Errorf("PoolRequests failed: %v", err) |
378 | | - } else { |
379 | | - t.Logf("PoolRequests(%d): %s", *flagPoolID, string(result)) |
380 | | - } |
381 | | - }) |
382 | | - |
383 | | - t.Run("ManifestAvailable", func(t *testing.T) { |
384 | | - result, err := client.ManifestAvailable(*flagPoolID) |
385 | | - if err != nil { |
386 | | - t.Errorf("ManifestAvailable failed: %v", err) |
387 | | - } else { |
388 | | - t.Logf("ManifestAvailable(%d): %s", *flagPoolID, string(result)) |
389 | | - } |
390 | | - }) |
391 | | - |
392 | 304 | // ---- Container / Logs (read-only) ---- |
393 | 305 |
|
394 | 306 | t.Run("FetchContainerLogs", func(t *testing.T) { |
@@ -462,152 +374,6 @@ func TestRealDeviceConnection(t *testing.T) { |
462 | 374 | } |
463 | 375 | }) |
464 | 376 |
|
465 | | - // ================================================================ |
466 | | - // Write / mutation operations — gated behind -enable-write |
467 | | - // ================================================================ |
468 | | - |
469 | | - // ---- Account Write ---- |
470 | | - |
471 | | - t.Run("AccountCreate", func(t *testing.T) { |
472 | | - if !*flagEnableWrite { |
473 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
474 | | - } |
475 | | - result, err := client.AccountCreate() |
476 | | - if err != nil { |
477 | | - t.Errorf("AccountCreate failed: %v", err) |
478 | | - } else { |
479 | | - t.Logf("AccountCreate: %s", string(result)) |
480 | | - } |
481 | | - }) |
482 | | - |
483 | | - t.Run("AccountFund", func(t *testing.T) { |
484 | | - if !*flagEnableWrite { |
485 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
486 | | - } |
487 | | - if *flagAccount == "" { |
488 | | - t.Skip("Skipped: pass -account to run AccountFund test") |
489 | | - } |
490 | | - result, err := client.AccountFund(*flagAccount) |
491 | | - if err != nil { |
492 | | - t.Errorf("AccountFund failed: %v", err) |
493 | | - } else { |
494 | | - t.Logf("AccountFund(%s): %s", *flagAccount, string(result)) |
495 | | - } |
496 | | - }) |
497 | | - |
498 | | - t.Run("TransferToFula", func(t *testing.T) { |
499 | | - if !*flagEnableWrite { |
500 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
501 | | - } |
502 | | - if *flagAccount == "" { |
503 | | - t.Skip("Skipped: pass -account to run TransferToFula test") |
504 | | - } |
505 | | - chain := *flagChain |
506 | | - if chain == "" { |
507 | | - chain = "mumbai" |
508 | | - } |
509 | | - result, err := client.TransferToFula("1000000000000000000", *flagAccount, chain) |
510 | | - if err != nil { |
511 | | - t.Errorf("TransferToFula failed: %v", err) |
512 | | - } else { |
513 | | - t.Logf("TransferToFula(1000000000000000000, %s, %s): %s", *flagAccount, chain, string(result)) |
514 | | - } |
515 | | - }) |
516 | | - |
517 | | - // ---- Pool Write ---- |
518 | | - |
519 | | - t.Run("PoolJoin", func(t *testing.T) { |
520 | | - if !*flagEnableWrite { |
521 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
522 | | - } |
523 | | - result, err := client.PoolJoin(*flagPoolID) |
524 | | - if err != nil { |
525 | | - t.Errorf("PoolJoin failed: %v", err) |
526 | | - } else { |
527 | | - t.Logf("PoolJoin(%d): %s", *flagPoolID, string(result)) |
528 | | - } |
529 | | - }) |
530 | | - |
531 | | - t.Run("PoolJoinWithChain", func(t *testing.T) { |
532 | | - if !*flagEnableWrite { |
533 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
534 | | - } |
535 | | - if *flagChain == "" { |
536 | | - t.Skip("Skipped: pass -chain to run PoolJoinWithChain test") |
537 | | - } |
538 | | - result, err := client.PoolJoinWithChain(*flagPoolID, *flagChain) |
539 | | - if err != nil { |
540 | | - t.Errorf("PoolJoinWithChain failed: %v", err) |
541 | | - } else { |
542 | | - t.Logf("PoolJoinWithChain(%d, %s): %s", *flagPoolID, *flagChain, string(result)) |
543 | | - } |
544 | | - }) |
545 | | - |
546 | | - t.Run("PoolCancelJoin", func(t *testing.T) { |
547 | | - if !*flagEnableWrite { |
548 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
549 | | - } |
550 | | - result, err := client.PoolCancelJoin(*flagPoolID) |
551 | | - if err != nil { |
552 | | - t.Errorf("PoolCancelJoin failed: %v", err) |
553 | | - } else { |
554 | | - t.Logf("PoolCancelJoin(%d): %s", *flagPoolID, string(result)) |
555 | | - } |
556 | | - }) |
557 | | - |
558 | | - t.Run("PoolLeave", func(t *testing.T) { |
559 | | - if !*flagEnableWrite { |
560 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
561 | | - } |
562 | | - result, err := client.PoolLeave(*flagPoolID) |
563 | | - if err != nil { |
564 | | - t.Errorf("PoolLeave failed: %v", err) |
565 | | - } else { |
566 | | - t.Logf("PoolLeave(%d): %s", *flagPoolID, string(result)) |
567 | | - } |
568 | | - }) |
569 | | - |
570 | | - t.Run("PoolLeaveWithChain", func(t *testing.T) { |
571 | | - if !*flagEnableWrite { |
572 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
573 | | - } |
574 | | - if *flagChain == "" { |
575 | | - t.Skip("Skipped: pass -chain to run PoolLeaveWithChain test") |
576 | | - } |
577 | | - result, err := client.PoolLeaveWithChain(*flagPoolID, *flagChain) |
578 | | - if err != nil { |
579 | | - t.Errorf("PoolLeaveWithChain failed: %v", err) |
580 | | - } else { |
581 | | - t.Logf("PoolLeaveWithChain(%d, %s): %s", *flagPoolID, *flagChain, string(result)) |
582 | | - } |
583 | | - }) |
584 | | - |
585 | | - t.Run("BatchUploadManifest", func(t *testing.T) { |
586 | | - if !*flagEnableWrite { |
587 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
588 | | - } |
589 | | - // Use a dummy CID for testing — the blox will reject unknown CIDs gracefully |
590 | | - cids := []byte("bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenera6dum") |
591 | | - result, err := client.BatchUploadManifest(cids, *flagPoolID, 1) |
592 | | - if err != nil { |
593 | | - t.Errorf("BatchUploadManifest failed: %v", err) |
594 | | - } else { |
595 | | - t.Logf("BatchUploadManifest: %s", string(result)) |
596 | | - } |
597 | | - }) |
598 | | - |
599 | | - t.Run("ReplicateInPool", func(t *testing.T) { |
600 | | - if !*flagEnableWrite { |
601 | | - t.Skip("Skipped: pass -enable-write to run write operations") |
602 | | - } |
603 | | - if *flagAccount == "" { |
604 | | - t.Skip("Skipped: pass -account to run ReplicateInPool test") |
605 | | - } |
606 | | - cids := []byte("bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenera6dum") |
607 | | - result := client.ReplicateInPool(cids, *flagAccount, *flagPoolID) |
608 | | - t.Logf("ReplicateInPool: %s", string(result)) |
609 | | - }) |
610 | | - |
611 | 377 | // ---- Plugin Write ---- |
612 | 378 |
|
613 | 379 | t.Run("InstallPlugin", func(t *testing.T) { |
|
0 commit comments