Skip to content

Commit

Permalink
app: improve name of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Apr 5, 2021
1 parent 9cf7f0a commit 1dcc806
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
12 changes: 6 additions & 6 deletions tsuru/data_source_tsuru_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func dataSourceTsuruApp() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
},

"internal_addresses": {
"internal_address": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Expand Down Expand Up @@ -88,7 +88,7 @@ func dataSourceTsuruApp() *schema.Resource {
},
},

"routers": {
"router": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Expand All @@ -99,7 +99,7 @@ func dataSourceTsuruApp() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
},
"opts": {
"options": {
Type: schema.TypeMap,
Elem: &schema.Schema{Type: schema.TypeString},
Computed: true,
Expand Down Expand Up @@ -135,8 +135,8 @@ func dataSourceTsuruAppRead(ctx context.Context, d *schema.ResourceData, meta in
d.Set("cluster", app.Cluster)
d.Set("tsuru_provisioner", app.Provisioner)

d.Set("internal_addresses", flattenInternalAddresses(app.InternalAddresses))
d.Set("routers", flattenRouters(app.Routers))
d.Set("internal_address", flattenInternalAddresses(app.InternalAddresses))
d.Set("router", flattenRouters(app.Routers))

d.Set("team_owner", app.TeamOwner)
d.Set("teams", app.Teams)
Expand Down Expand Up @@ -167,7 +167,7 @@ func flattenRouters(routers []tsuru.AppRouters) []interface{} {
result = append(result, map[string]interface{}{
"addresses": router.Addresses,
"name": router.Name,
"opts": router.Opts,
"options": router.Opts,
})
}

Expand Down
46 changes: 23 additions & 23 deletions tsuru/data_source_tsuru_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,33 @@ func TestAccDatasourceTsuruApp_basic(t *testing.T) {
resource.TestCheckResourceAttr("data.tsuru_app.app01", "pool", "my-pool"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "tsuru_provisioner", "kubernetes"),

resource.TestCheckResourceAttr("data.tsuru_app.app01", "routers.0.addresses.0", "web.app01.tsuru.io"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "routers.0.addresses.1", "v2.web.app01.tsuru.io"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "routers.0.opts.enable-feature-x", "true"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "routers.0.name", "external-router"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "router.0.addresses.0", "web.app01.tsuru.io"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "router.0.addresses.1", "v2.web.app01.tsuru.io"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "router.0.options.enable-feature-x", "true"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "router.0.name", "external-router"),

resource.TestCheckResourceAttr("data.tsuru_app.app01", "routers.1.addresses.0", "web.app01.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "routers.1.addresses.1", "v2.web.app01.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "routers.1.opts.enable-feature-y", "true"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "routers.1.name", "vpn-router"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "router.1.addresses.0", "web.app01.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "router.1.addresses.1", "v2.web.app01.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "router.1.options.enable-feature-y", "true"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "router.1.name", "vpn-router"),

resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.0.domain", "myapp-web.namespace.svc.cluster.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.0.port", "8888"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.0.protocol", "TCP"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.0.process", "web"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.0.version", ""),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.0.domain", "myapp-web.namespace.svc.cluster.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.0.port", "8888"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.0.protocol", "TCP"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.0.process", "web"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.0.version", ""),

resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.1.domain", "myapp-subscriber.namespace.svc.cluster.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.1.port", "8888"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.1.protocol", "TCP"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.1.process", "subscriber"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.1.version", ""),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.1.domain", "myapp-subscriber.namespace.svc.cluster.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.1.port", "8888"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.1.protocol", "TCP"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.1.process", "subscriber"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.1.version", ""),

resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.2.domain", "myapp-web-v2.namespace.svc.cluster.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.2.port", "8888"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.2.protocol", "TCP"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.2.process", "web"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_addresses.2.version", "2"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.2.domain", "myapp-web-v2.namespace.svc.cluster.local"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.2.port", "8888"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.2.protocol", "TCP"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.2.process", "web"),
resource.TestCheckResourceAttr("data.tsuru_app.app01", "internal_address.2.version", "2"),
),
},
},
Expand Down

0 comments on commit 1dcc806

Please sign in to comment.