Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Update SF labels to use explicit methods and add missing labels #16

Merged
merged 15 commits into from
Mar 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
.vscode/
vendor/
*.swp
113 changes: 83 additions & 30 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ignored = ["github.com/containous/traefik/autogen/genstatic"]

[[constraint]]
branch = "master"
name = "github.com/jjcollinge/servicefabric"
revision = "8eebe170fa1ba25d3dfb928b3f86a7313b13b9fe"

[[constraint]]
branch = "master"
Expand Down
34 changes: 25 additions & 9 deletions client_mock_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package servicefabric

import (
"fmt"

sf "github.com/jjcollinge/servicefabric"
)

type clientMock struct {
applications *sf.ApplicationItemsPage
services *sf.ServiceItemsPage
partitions *sf.PartitionItemsPage
replicas *sf.ReplicaItemsPage
instances *sf.InstanceItemsPage
labels map[string]string
applications *sf.ApplicationItemsPage
services *sf.ServiceItemsPage
partitions *sf.PartitionItemsPage
replicas *sf.ReplicaItemsPage
instances *sf.InstanceItemsPage
getServicelabelsResult map[string]string
expectedPropertyName string
getServiceExtensionMapResult map[string]string
getPropertiesResult map[string]string
}

func (c *clientMock) GetApplications() (*sf.ApplicationItemsPage, error) {
Expand All @@ -33,10 +38,21 @@ func (c *clientMock) GetInstances(appName, serviceName, partitionName string) (*
return c.instances, nil
}

func (c *clientMock) GetServiceExtension(appType, applicationVersion, serviceTypeName, extensionKey string, response interface{}) error {
return nil
func (c *clientMock) GetServiceExtensionMap(service *sf.ServiceItem, app *sf.ApplicationItem, extensionKey string) (map[string]string, error) {
if extensionKey != traefikServiceFabricExtensionKey {
return nil, fmt.Errorf("extension key not expected value have: %s expect: %s", extensionKey, traefikServiceFabricExtensionKey)
}
return c.getServiceExtensionMapResult, nil
}

func (c *clientMock) GetServiceLabels(service *sf.ServiceItem, app *sf.ApplicationItem, prefix string) (map[string]string, error) {
return c.labels, nil
return c.getServicelabelsResult, nil
}

// Note this is dumb mock the `exists`
func (c *clientMock) GetProperties(name string) (bool, map[string]string, error) {
if c.expectedPropertyName == name {
return true, c.getPropertiesResult, nil
}
return false, nil, nil
}
31 changes: 0 additions & 31 deletions labels.go

This file was deleted.

Loading