mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 19:12:54 +00:00
- Add discovery_test.go with Service and ServiceDiscovery struct tests - Add integration test placeholders for service registration, discovery, deregistration, and health checks - Add mq_test.go with Message serialization and profile event tests - Add integration test placeholders for RabbitMQ connectivity, queue declaration, and publish/consume flow - Add github.com/stretchr/testify v1.11.1 to carrier-connector dependencies
62 lines
1.8 KiB
Go
62 lines
1.8 KiB
Go
package discovery
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// TestServiceRegistration tests service registration with Consul
|
|
func TestServiceRegistration(t *testing.T) {
|
|
// Skip if Consul is not available
|
|
t.Skip("Skipping integration test - requires Consul server")
|
|
}
|
|
|
|
// TestServiceDiscovery tests service discovery from Consul
|
|
func TestServiceDiscovery(t *testing.T) {
|
|
// Skip if Consul is not available
|
|
t.Skip("Skipping integration test - requires Consul server")
|
|
}
|
|
|
|
// TestServiceDeregistration tests service deregistration from Consul
|
|
func TestServiceDeregistration(t *testing.T) {
|
|
// Skip if Consul is not available
|
|
t.Skip("Skipping integration test - requires Consul server")
|
|
}
|
|
|
|
// TestServiceStruct tests the Service struct
|
|
func TestServiceStruct(t *testing.T) {
|
|
service := Service{
|
|
ID: "test-service-1",
|
|
Name: "api-server",
|
|
Address: "localhost",
|
|
Port: 8080,
|
|
Tags: []string{"api", "telecom"},
|
|
}
|
|
|
|
assert.Equal(t, "test-service-1", service.ID)
|
|
assert.Equal(t, "api-server", service.Name)
|
|
assert.Equal(t, "localhost", service.Address)
|
|
assert.Equal(t, 8080, service.Port)
|
|
assert.Equal(t, []string{"api", "telecom"}, service.Tags)
|
|
}
|
|
|
|
// TestServiceDiscoveryStruct tests the ServiceDiscovery struct
|
|
func TestServiceDiscoveryStruct(t *testing.T) {
|
|
// This test verifies the struct can be created
|
|
// Actual connection testing requires a running Consul instance
|
|
assert.NotNil(t, ServiceDiscovery{})
|
|
}
|
|
|
|
// TestDiscoverService tests the Discover method
|
|
func TestDiscoverService(t *testing.T) {
|
|
// Skip if Consul is not available
|
|
t.Skip("Skipping integration test - requires Consul server")
|
|
}
|
|
|
|
// TestHealthCheck tests health check of discovered services
|
|
func TestHealthCheck(t *testing.T) {
|
|
// Skip if Consul is not available
|
|
t.Skip("Skipping integration test - requires Consul server")
|
|
}
|