Skip to main content
Glama
version.exp6.18 kB
#!/usr/bin/env expect # Exit codes: # 0 - Test passed # 1 - Test failed # Set timeout for command execution set timeout 30 # Colors for output set GREEN "\033\[0;32m" set RED "\033\[0;31m" set YELLOW "\033\[1;33m" set BLUE "\033\[0;34m" set NC "\033\[0m" # Get the gbox binary path # Default to using the built binary in the parent directory set gbox_binary "../gbox" # If the built binary doesn't exist, fall back to system gbox if {![file exists $gbox_binary]} { set gbox_binary "gbox" } puts "${BLUE}Testing gbox version command...${NC}" # Test 1: Basic version command puts "\n${YELLOW}Testing basic version command...${NC}" if {[catch { spawn $gbox_binary version expect { -re "Client:" { puts "${GREEN}✓ Found 'Client:' header${NC}" } timeout { puts "${RED}✗ Timeout waiting for 'Client:' header${NC}" exit 1 } eof { puts "${RED}✗ Command exited unexpectedly${NC}" exit 1 } } # Check for version information fields expect { -re "Version:" { puts "${GREEN}✓ Found Version field${NC}" } timeout { puts "${RED}✗ Timeout waiting for Version field${NC}" exit 1 } } expect { -re "API version:" { puts "${GREEN}✓ Found API version field${NC}" } timeout { puts "${RED}✗ Timeout waiting for API version field${NC}" exit 1 } } expect { -re "Go version:" { puts "${GREEN}✓ Found Go version field${NC}" } timeout { puts "${RED}✗ Timeout waiting for Go version field${NC}" exit 1 } } expect { -re "Git commit:" { puts "${GREEN}✓ Found Git commit field${NC}" } timeout { puts "${RED}✗ Timeout waiting for Git commit field${NC}" exit 1 } } expect { -re "Built:" { puts "${GREEN}✓ Found Built field${NC}" } timeout { puts "${RED}✗ Timeout waiting for Built field${NC}" exit 1 } } expect { -re "OS/Arch:" { puts "${GREEN}✓ Found OS/Arch field${NC}" } timeout { puts "${RED}✗ Timeout waiting for OS/Arch field${NC}" exit 1 } } expect { eof { puts "${GREEN}✓ Command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for command completion${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Test failed: $result${NC}" exit 1 } # Test 2: Short version format (-v flag) puts "\n${YELLOW}Testing short version format (-v flag)...${NC}" if {[catch { spawn $gbox_binary version -v expect { -re "GBOX version .*, build .*" { puts "${GREEN}✓ Found short version format${NC}" } timeout { puts "${RED}✗ Timeout waiting for short version format${NC}" exit 1 } eof { puts "${RED}✗ Command exited unexpectedly${NC}" exit 1 } } expect { eof { puts "${GREEN}✓ Short version command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for short version completion${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Short version test failed: $result${NC}" exit 1 } # Test 3: JSON output format puts "\n${YELLOW}Testing JSON output format...${NC}" if {[catch { spawn $gbox_binary version -o json expect { -re "\{" { puts "${GREEN}✓ Found JSON opening brace${NC}" } timeout { puts "${RED}✗ Timeout waiting for JSON output${NC}" exit 1 } eof { puts "${RED}✗ Command exited unexpectedly${NC}" exit 1 } } expect { -re "\"Client\":" { puts "${GREEN}✓ Found Client object in JSON${NC}" } timeout { puts "${RED}✗ Timeout waiting for Client object${NC}" exit 1 } } expect { -re "\"Version\":" { puts "${GREEN}✓ Found Version field in JSON${NC}" } timeout { puts "${RED}✗ Timeout waiting for Version field in JSON${NC}" exit 1 } } expect { -re "\}" { puts "${GREEN}✓ Found JSON closing brace${NC}" } timeout { puts "${RED}✗ Timeout waiting for JSON closing brace${NC}" exit 1 } } expect { eof { puts "${GREEN}✓ JSON version command completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for JSON version completion${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ JSON version test failed: $result${NC}" exit 1 } # Test 4: Root command version flag puts "\n${YELLOW}Testing root command version flag...${NC}" if {[catch { spawn $gbox_binary -v expect { -re "GBOX version .*, build .*" { puts "${GREEN}✓ Found root command version output${NC}" } timeout { puts "${RED}✗ Timeout waiting for root command version${NC}" exit 1 } eof { puts "${RED}✗ Root command exited unexpectedly${NC}" exit 1 } } expect { eof { puts "${GREEN}✓ Root command version completed successfully${NC}" } timeout { puts "${RED}✗ Timeout waiting for root command completion${NC}" exit 1 } } catch {close} } result]} { puts "${RED}✗ Root command version test failed: $result${NC}" exit 1 } puts "\n${GREEN}All version tests passed successfully!${NC}" exit 0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/babelcloud/gru-sandbox'

If you have feedback or need assistance with the MCP directory API, please join our Discord server