MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / add_then_remove_cycle

Function add_then_remove_cycle

crates/chat-cli/src/cli/mcp.rs:638–678  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

636 #[ignore = "TODO: fix in CI"]
637 #[tokio::test]
638 async fn add_then_remove_cycle() {
639 let os = Os::new().await.unwrap();
640
641 // 1. add
642 AddArgs {
643 name: "local".into(),
644 scope: None,
645 command: "echo hi".into(),
646 args: vec![
647 "awslabs.eks-mcp-server".to_string(),
648 "--allow-write".to_string(),
649 "--allow-sensitive-data-access".to_string(),
650 ],
651 env: vec![],
652 timeout: None,
653 agent: None,
654 disabled: false,
655 force: false,
656 }
657 .execute(&os, &mut vec![])
658 .await
659 .unwrap();
660
661 let cfg_path = workspace_mcp_config_path(&os).unwrap();
662 let cfg: McpServerConfig =
663 serde_json::from_str(&os.fs.read_to_string(cfg_path.clone()).await.unwrap()).unwrap();
664 assert!(cfg.mcp_servers.len() == 1);
665
666 // 2. remove
667 RemoveArgs {
668 name: "local".into(),
669 scope: None,
670 agent: None,
671 }
672 .execute(&os, &mut vec![])
673 .await
674 .unwrap();
675
676 let cfg: McpServerConfig = serde_json::from_str(&os.fs.read_to_string(cfg_path).await.unwrap()).unwrap();
677 assert!(cfg.mcp_servers.is_empty());
678 }
679
680 #[test]
681 fn test_mcp_subcommand_add() {

Callers

nothing calls this directly

Calls 4

read_to_stringMethod · 0.80
executeMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected