-
Notifications
You must be signed in to change notification settings - Fork 14
Update SF labels to use explicit methods and add missing labels #16
Conversation
f8b299d
to
e867263
Compare
FYI:
I assume the tests are in WIP but I think we must change the way that we test:
We must remove tests on labels from |
Thanks. Wasn't sure what to work off :) Good Idea, I'll reformat the labels tests I added to use Shall I tackle splitting the
Sound like a good plan? On an unrelated note is there a reason the MakeFile uses this syntax |
Sound like a very good plan! 😄 gometalinter support Before go1.9, |
6ae31ea
to
1799674
Compare
Test refactoring is done (hopefully), if it looks good I'll add in additional use cases and start working on the additional labels too. |
1799674
to
f0ba5e2
Compare
@ldez Hey, gometalinter fails on gocyclo tests for the labels test as it's quite long one now. I've looked at trying to break it up but, imo, it makes it harder to read and update (for example pulling out each validate func into a full func rather than inline). Happy to split it up if that would be your preference. No rush on this as I'm on leave from today until the new year so unlikely to be doing a huge amount on it. |
You can split in 2 test methods:
WDYT? |
Good call but already have that. gocyclo still fails because there are lots of frontend labels to test, I'll maybe have a play at pulling out the I did stop for a bit and think that the tests were overkill but as it's easy to edit the tmpl file and not notice it causing a bug with a label I do think they are of value. WDYT? |
I will try to customize the gocylo configuration. |
gocyclo doesn't have "real" configuration. I think we can add // nocyclo
func TestFrontendLabelConfig(t *testing.T){
// ...
}
// nocyclo
func TestBackendLabelConfig(t *testing.T){
// ...
} |
Sorry mistake, it's |
77654ad
to
438aafc
Compare
np, should have tested it locally - did the trick there are some failing tests which I'm expecting during the refactoring |
5b00db2
to
4a26c56
Compare
@ldez hopefully this is no-longer WIP and ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lawrencegripper few quick notes
@@ -58,7 +61,7 @@ const tmpl = ` | |||
{{range $replica := $partition.Replicas}} | |||
{{if isPrimary $replica}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How to route to secondaries when listenOnSecondary enabled - can be added later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh interesting, lets chat about this one maybe best as a separate PR as this is already pretty chunky
servicefabric_tmpl.go
Outdated
{{range $partition := $service.Partitions}} | ||
{{if eq $partition.ServiceKind "Stateless"}} | ||
{{if eq $partition.ServiceKind "Stateless"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a function isStateless
rather than a hard-coded string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done now, brain dead simple func but added some tests too
servicefabric.go
Outdated
|
||
return p.GetConfiguration(tmpl, sfFuncMap, templateObjects) | ||
} | ||
|
||
func getDefaultEndpoint(instance replicaInstance) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: order functions in servicefabric.go for readability:
- local functions i.e. getClusterServices
- template functions i.e. getDefaultEndpoint
- helper functions i.e. decodeEndpointData
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good spot, I've gone a step further and moved template funcs into config.go
so only funcs related to enumerating services are left in this file. Think it makes things cleaner - what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… with labels file.
…l name not suffix
a924bdd
to
9693d1b
Compare
LGTM |
Hi,
This is WIP at the moment but I wanted to check in before I go much further - in case this is the wrong direction.
PassTLSCert
,FrameDeny
andRequestHeaders
providers/labels
soisExposed
->Enabled
func
are havefunc
in the name and those that don't don'tLet me know if this all makes sense and I'll continue to add the remaining labels from the docker provider implementation in v1.5