-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Backends
field to Director
#347
Conversation
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.
Quick review guidance...
b, errBackend = c.CreateBackend(&CreateBackendInput{ | ||
ServiceID: testServiceID, | ||
ServiceVersion: tv.Number, | ||
Name: "test-backend", | ||
Address: "integ-test.go-fastly.com", | ||
Port: Uint(1234), | ||
ConnectTimeout: Uint(1500), | ||
OverrideHost: "origin.example.com", | ||
SSLCiphers: "DHE-RSA-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:AES256-GCM-SHA384", | ||
}) | ||
d, errDirector = c.CreateDirector(&CreateDirectorInput{ | ||
ServiceID: testServiceID, | ||
ServiceVersion: tv.Number, | ||
Name: "test-director", | ||
Quorum: Uint(50), | ||
Type: DirectorTypeRandom, | ||
Retries: Uint(5), | ||
}) | ||
_, errDirectorBackend = c.CreateDirectorBackend(&CreateDirectorBackendInput{ | ||
ServiceID: testServiceID, | ||
ServiceVersion: tv.Number, | ||
Director: "test-director", | ||
Backend: b.Name, |
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.
In the test suite I ensure when creating a Director we also create a Backend and then create a relationship between the two.
if len(nb.Backends) == 0 || nb.Backends[0] != b.Name { | ||
t.Error("bad backend: expected a backend") | ||
} |
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.
This test assertion validates that the requested Director contains the Backend we expect it to.
cc @jdigory who reported this issue. |
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.
Looks good 👍
Problem: The Fastly Terraform Provider is inefficiently checking for backend membership within a Director, resulting in API requests reaching 1000+ in some cases for customers.
Solution: Expose the
backends
field on the director so that the Terraform Provider can quickly validate which service backends are members of the director.