/ go / run_tests.sh
run_tests.sh
 1  #!/bin/bash
 2  
 3  # Kamaji Go Test Suite Runner
 4  set -e
 5  
 6  echo "๐Ÿงช Kamaji Go Test Suite"
 7  echo "======================="
 8  
 9  # Colors for output
10  RED='\033[0;31m'
11  GREEN='\033[0;32m'
12  YELLOW='\033[1;33m'
13  BLUE='\033[0;34m'
14  NC='\033[0m' # No Color
15  
16  # Test categories
17  UNIT_TESTS="./internal/tools/... ./internal/config/... ./internal/providers/..."
18  INTEGRATION_TESTS="./test/..."
19  
20  echo -e "${BLUE}๐Ÿ“‹ Running Unit Tests...${NC}"
21  if go test -v $UNIT_TESTS; then
22      echo -e "${GREEN}โœ… Unit tests passed${NC}"
23  else
24      echo -e "${RED}โŒ Unit tests failed${NC}"
25      exit 1
26  fi
27  
28  echo ""
29  echo -e "${BLUE}๐Ÿ”— Running Integration Tests...${NC}"
30  if go test -v $INTEGRATION_TESTS; then
31      echo -e "${GREEN}โœ… Integration tests passed${NC}"
32  else
33      echo -e "${RED}โŒ Integration tests failed${NC}"
34      exit 1
35  fi
36  
37  echo ""
38  echo -e "${BLUE}โšก Running Benchmarks...${NC}"
39  go test -bench=. -benchmem ./test/... | grep -E "(Benchmark|PASS|FAIL)"
40  
41  echo ""
42  echo -e "${BLUE}๐Ÿ“Š Test Coverage...${NC}"
43  go test -cover $UNIT_TESTS $INTEGRATION_TESTS
44  
45  echo ""
46  echo -e "${BLUE}๐Ÿ—๏ธ  Build Test...${NC}"
47  if go build -o bin/kamaji-test ./cmd/kamaji; then
48      echo -e "${GREEN}โœ… Build successful${NC}"
49      rm -f bin/kamaji-test
50  else
51      echo -e "${RED}โŒ Build failed${NC}"
52      exit 1
53  fi
54  
55  echo ""
56  echo -e "${GREEN}๐ŸŽ‰ All tests passed!${NC}"
57  echo ""
58  echo -e "${YELLOW}๐Ÿ“ˆ Test Summary:${NC}"
59  echo "โ€ข Unit tests: Tools, Config, Providers"
60  echo "โ€ข Integration tests: CLI, Agents, Workflows"
61  echo "โ€ข Performance tests: Startup time, Tool execution"
62  echo "โ€ข Build verification: Binary compilation"