Skip to content

Commit

Permalink
refactor: rename uid to id (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
1riatsila1 authored Nov 14, 2024
1 parent 1a0e5b0 commit f30c5a1
Show file tree
Hide file tree
Showing 47 changed files with 1,028 additions and 1,029 deletions.
14 changes: 7 additions & 7 deletions test/live/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ package config
// Configuration-API Acceptance Testing (844457745a1111ef880836000a52e73e)
// And therefore the client_id and client_secret used for the acceptance tests must match this
// customer.
const AgentPermanentUid = "8260f349-5c73-394a-b786-57985d001763"
const AgentPermanentId = "8260f349-5c73-394a-b786-57985d001763"
const AgentCreateSerial = "56fb38331f19d278"
const CustomerUid = "9c16d493-7649-40bc-975b-07422d227c0b"
const GroupUidRoot = "07422d227c0b"
const WiredNetworkUid = "ethernet-0ee5b46c2ef0"
const CustomerId = "9c16d493-7649-40bc-975b-07422d227c0b"
const GroupIdRoot = "07422d227c0b"
const WiredNetworkId = "ethernet-0ee5b46c2ef0"
const WiredNetworkName = "tf-provider-acceptance-tests-ethernet-0"
const WirelessNetworkUid = "ssid-bf704ff37dc0"
const WirelessNetworkId = "ssid-bf704ff37dc0"
const WirelessNetworkName = "tf-provider-acceptance-tests-ssid-0"
const ServiceTestUid = "6f81e43d-76f1-4a15-aafe-4ce2371d918a"
const ServiceTestId = "6f81e43d-76f1-4a15-aafe-4ce2371d918a"
const ServiceTestName = "tf-provider-acceptance-test-0"
const SensorUid = "4b031caf-cea8-411d-8928-79f518163dae"
const SensorId = "4b031caf-cea8-411d-8928-79f518163dae"

const DeviceGatewayHost = "https://device-gateway.staging.capedev.io"
2 changes: 1 addition & 1 deletion test/live/datasources/agent_group_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestAgentGroupAssignmentDataSource(t *testing.T) {
data "uxi_agent" "my_agent" {
filter = {
agent_id = "` + config.AgentPermanentUid + `"
agent_id = "` + config.AgentPermanentId + `"
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/live/datasources/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
)

func TestAgentDataSource(t *testing.T) {
agent := util.GetAgentProperties(config.AgentPermanentUid)
agent := util.GetAgentProperties(config.AgentPermanentId)
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: provider.ProviderConfig + `
data "uxi_agent" "my_agent" {
filter = {
agent_id = "` + config.AgentPermanentUid + `"
agent_id = "` + config.AgentPermanentId + `"
}
}
`,
Expand Down
4 changes: 2 additions & 2 deletions test/live/datasources/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestGroupDataSource(t *testing.T) {
Config: provider.ProviderConfig + `
data "uxi_group" "my_group" {
filter = {
group_id = "` + config.GroupUidRoot + `"
group_id = "` + config.GroupIdRoot + `"
}
}
`,
Expand Down Expand Up @@ -61,7 +61,7 @@ func TestGroupDataSource(t *testing.T) {
resource.TestCheckResourceAttr(
"data.uxi_group.my_group",
"parent_group_id",
config.GroupUidRoot,
config.GroupIdRoot,
),
),
},
Expand Down
2 changes: 1 addition & 1 deletion test/live/datasources/network_group_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestNetworkGroupAssignmentDataSource(t *testing.T) {
data "uxi_wired_network" "my_network" {
filter = {
wired_network_id = "` + config.WiredNetworkUid + `"
wired_network_id = "` + config.WiredNetworkId + `"
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/live/datasources/sensor_group_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestSensorGroupAssignmentDataSource(t *testing.T) {
data "uxi_sensor" "my_sensor" {
filter = {
sensor_id = "` + config.SensorUid + `"
sensor_id = "` + config.SensorId + `"
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/live/datasources/sensor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
)

func TestSensorDataSource(t *testing.T) {
sensor := util.GetSensorProperties(config.SensorUid)
sensor := util.GetSensorProperties(config.SensorId)
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: provider.ProviderConfig + `
data "uxi_sensor" "my_sensor" {
filter = {
sensor_id = "` + config.SensorUid + `"
sensor_id = "` + config.SensorId + `"
}
}
`,
Expand Down
4 changes: 2 additions & 2 deletions test/live/datasources/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestServiceTestDataSource(t *testing.T) {
serviceTest := util.GetServiceTest(config.ServiceTestUid)
serviceTest := util.GetServiceTest(config.ServiceTestId)

resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
Expand All @@ -19,7 +19,7 @@ func TestServiceTestDataSource(t *testing.T) {
Config: provider.ProviderConfig + `
data "uxi_service_test" "my_service_test" {
filter = {
service_test_id = "` + config.ServiceTestUid + `"
service_test_id = "` + config.ServiceTestId + `"
}
}
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestServiceTestGroupAssignmentDataSource(t *testing.T) {
data "uxi_service_test" "my_service_test" {
filter = {
service_test_id = "` + config.ServiceTestUid + `"
service_test_id = "` + config.ServiceTestId + `"
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/live/datasources/wired_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestWiredNetworkDataSource(t *testing.T) {
wired_network := util.GetWiredNetwork(config.WiredNetworkUid)
wired_network := util.GetWiredNetwork(config.WiredNetworkId)

resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
Expand All @@ -19,7 +19,7 @@ func TestWiredNetworkDataSource(t *testing.T) {
Config: provider.ProviderConfig + `
data "uxi_wired_network" "my_wired_network" {
filter = {
wired_network_id = "` + config.WiredNetworkUid + `"
wired_network_id = "` + config.WiredNetworkId + `"
}
}
`,
Expand Down
4 changes: 2 additions & 2 deletions test/live/datasources/wireless_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestWirelessNetworkDataSource(t *testing.T) {
wireless_network := util.GetWirelessNetwork(config.WirelessNetworkUid)
wireless_network := util.GetWirelessNetwork(config.WirelessNetworkId)

resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
Expand All @@ -19,7 +19,7 @@ func TestWirelessNetworkDataSource(t *testing.T) {
Config: provider.ProviderConfig + `
data "uxi_wireless_network" "my_wireless_network" {
filter = {
wireless_network_id = "` + config.WirelessNetworkUid + `"
wireless_network_id = "` + config.WirelessNetworkId + `"
}
}
`,
Expand Down
8 changes: 4 additions & 4 deletions test/live/resources/agent_group_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestAgentGroupAssignmentResource(t *testing.T) {
data "uxi_agent" "my_agent" {
filter = {
agent_id = "` + config.AgentPermanentUid + `"
agent_id = "` + config.AgentPermanentId + `"
}
}
Expand All @@ -40,7 +40,7 @@ func TestAgentGroupAssignmentResource(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_agent_group_assignment.my_agent_group_assignment",
"agent_id",
config.AgentPermanentUid,
config.AgentPermanentId,
),
resource.TestCheckResourceAttrWith(
"uxi_agent_group_assignment.my_agent_group_assignment",
Expand Down Expand Up @@ -78,7 +78,7 @@ func TestAgentGroupAssignmentResource(t *testing.T) {
data "uxi_agent" "my_agent" {
filter = {
agent_id = "` + config.AgentPermanentUid + `"
agent_id = "` + config.AgentPermanentId + `"
}
}
Expand All @@ -97,7 +97,7 @@ func TestAgentGroupAssignmentResource(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_agent_group_assignment.my_agent_group_assignment",
"agent_id",
config.AgentPermanentUid,
config.AgentPermanentId,
),
resource.TestCheckResourceAttrWith(
"uxi_agent_group_assignment.my_agent_group_assignment",
Expand Down
10 changes: 5 additions & 5 deletions test/live/resources/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ func TestAgentResource(t *testing.T) {
)

// we provision an agent here so that we have something to delete later on
agentUid, err := util.ProvisionAgent{
CustomerUid: config.CustomerUid,
agentId, err := util.ProvisionAgent{
CustomerId: config.CustomerId,
ProvisionToken: os.Getenv("UXI_PROVISION_TOKEN"),
DeviceSerial: config.AgentCreateSerial,
DeviceGatewayHost: config.DeviceGatewayHost,
Expand Down Expand Up @@ -53,14 +53,14 @@ func TestAgentResource(t *testing.T) {
import {
to = uxi_agent.my_agent
id = "` + agentUid + `"
id = "` + agentId + `"
}`,

Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("uxi_agent.my_agent", "name", agentName),
resource.TestCheckResourceAttr("uxi_agent.my_agent", "notes", ""),
resource.TestCheckResourceAttr("uxi_agent.my_agent", "pcap_mode", "light"),
resource.TestCheckResourceAttr("uxi_agent.my_agent", "id", agentUid),
resource.TestCheckResourceAttr("uxi_agent.my_agent", "id", agentId),
),
},
// ImportState testing
Expand All @@ -78,7 +78,7 @@ func TestAgentResource(t *testing.T) {
pcap_mode = "off"
}`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("uxi_agent.my_agent", "id", agentUid),
resource.TestCheckResourceAttr("uxi_agent.my_agent", "id", agentId),
resource.TestCheckResourceAttr("uxi_agent.my_agent", "name", agentNameUpdated),
resource.TestCheckResourceAttr("uxi_agent.my_agent", "notes", "notes"),
resource.TestCheckResourceAttr("uxi_agent.my_agent", "pcap_mode", "off"),
Expand Down
2 changes: 1 addition & 1 deletion test/live/resources/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestRootGroupResource(t *testing.T) {
import {
to = uxi_group.my_root_group
id = "` + config.GroupUidRoot + `"
id = "` + config.GroupIdRoot + `"
}`,
ExpectError: regexp.MustCompile(`The root group cannot be used as a resource`),
},
Expand Down
16 changes: 8 additions & 8 deletions test/live/resources/network_group_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) {
import {
to = uxi_wired_network.my_network
id = "` + config.WiredNetworkUid + `"
id = "` + config.WiredNetworkId + `"
}
resource "uxi_network_group_assignment" "my_network_group_assignment" {
Expand All @@ -42,7 +42,7 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_network_group_assignment.my_network_group_assignment",
"network_id",
config.WiredNetworkUid,
config.WiredNetworkId,
),
resource.TestCheckResourceAttrWith(
"uxi_network_group_assignment.my_network_group_assignment",
Expand Down Expand Up @@ -74,7 +74,7 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) {
import {
to = uxi_wired_network.my_network
id = "` + config.WiredNetworkUid + `"
id = "` + config.WiredNetworkId + `"
}
// the new resources we wanna update the assignment to
Expand All @@ -91,7 +91,7 @@ func TestNetworkGroupAssignmentResourceForWiredNetwork(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_network_group_assignment.my_network_group_assignment",
"network_id",
config.WiredNetworkUid,
config.WiredNetworkId,
),
resource.TestCheckResourceAttrWith(
"uxi_network_group_assignment.my_network_group_assignment",
Expand Down Expand Up @@ -139,7 +139,7 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) {
import {
to = uxi_wireless_network.my_network
id = "` + config.WirelessNetworkUid + `"
id = "` + config.WirelessNetworkId + `"
}
resource "uxi_network_group_assignment" "my_network_group_assignment" {
Expand All @@ -150,7 +150,7 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_network_group_assignment.my_network_group_assignment",
"network_id",
config.WirelessNetworkUid,
config.WirelessNetworkId,
),
resource.TestCheckResourceAttrWith(
"uxi_network_group_assignment.my_network_group_assignment",
Expand Down Expand Up @@ -182,7 +182,7 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) {
import {
to = uxi_wireless_network.my_network
id = "` + config.WirelessNetworkUid + `"
id = "` + config.WirelessNetworkId + `"
}
// the new resources we wanna update the assignment to
Expand All @@ -199,7 +199,7 @@ func TestNetworkGroupAssignmentResourceForWirelessNetwork(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_network_group_assignment.my_network_group_assignment",
"network_id",
config.WirelessNetworkUid,
config.WirelessNetworkId,
),
resource.TestCheckResourceAttrWith(
"uxi_network_group_assignment.my_network_group_assignment",
Expand Down
8 changes: 4 additions & 4 deletions test/live/resources/sensor_group_assignment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func TestSensorGroupAssignmentResource(t *testing.T) {
const groupName = "tf_provider_acceptance_test_sensor_assignment_test"
const group2Name = "tf_provider_acceptance_test_sensor_assignment_test_two"
existingSensorProperties := util.GetSensorProperties(config.SensorUid)
existingSensorProperties := util.GetSensorProperties(config.SensorId)

resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
Expand All @@ -34,7 +34,7 @@ func TestSensorGroupAssignmentResource(t *testing.T) {
import {
to = uxi_sensor.my_sensor
id = "` + config.SensorUid + `"
id = "` + config.SensorId + `"
}
resource "uxi_sensor_group_assignment" "my_sensor_group_assignment" {
Expand All @@ -45,7 +45,7 @@ func TestSensorGroupAssignmentResource(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_sensor_group_assignment.my_sensor_group_assignment",
"sensor_id",
config.SensorUid,
config.SensorId,
),
resource.TestCheckResourceAttrWith(
"uxi_sensor_group_assignment.my_sensor_group_assignment",
Expand Down Expand Up @@ -92,7 +92,7 @@ func TestSensorGroupAssignmentResource(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_sensor_group_assignment.my_sensor_group_assignment",
"sensor_id",
config.SensorUid,
config.SensorId,
),
resource.TestCheckResourceAttrWith(
"uxi_sensor_group_assignment.my_sensor_group_assignment",
Expand Down
6 changes: 3 additions & 3 deletions test/live/resources/sensor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (
)

func TestSensorResource(t *testing.T) {
originalSensor := util.GetSensorProperties(config.SensorUid)
originalSensor := util.GetSensorProperties(config.SensorId)
updatedNotes := "tf_provider_acceptance_test_update_notes"
updatedAddressNote := "tf_provider_acceptance_test_update_address_note"
updatedPcapMode := "off"
updatedSensor := config_api_client.SensorItem{
Id: config.SensorUid,
Id: config.SensorId,
Name: "tf_provider_acceptance_test_update_name",
Notes: *config_api_client.NewNullableString(&updatedNotes),
AddressNote: *config_api_client.NewNullableString(&updatedAddressNote),
Expand Down Expand Up @@ -52,7 +52,7 @@ func TestSensorResource(t *testing.T) {
import {
to = uxi_sensor.my_sensor
id = "` + config.SensorUid + `"
id = "` + config.SensorId + `"
}`,

Check: resource.ComposeAggregateTestCheckFunc(),
Expand Down
4 changes: 2 additions & 2 deletions test/live/resources/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestServiceTestResource(t *testing.T) {
import {
to = uxi_service_test.my_service_test
id = "` + config.ServiceTestUid + `"
id = "` + config.ServiceTestId + `"
}`,

Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -50,7 +50,7 @@ func TestServiceTestResource(t *testing.T) {
resource.TestCheckResourceAttr(
"uxi_service_test.my_service_test",
"id",
config.ServiceTestUid,
config.ServiceTestId,
),
),
},
Expand Down
Loading

0 comments on commit f30c5a1

Please sign in to comment.