Skip to content

Commit 1cea7fb

Browse files
authored
Rename integration to end-to-end to better reflect what they do (#9)
1 parent f409356 commit 1cea7fb

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Flags:
138138
## Development
139139

140140
### Running Tests
141-
`cloudflare-ddns` has a suite of integration tests that actually run the real program against a real CloudFlare account to verify functionality.
141+
`cloudflare-ddns` has a suite of end-to-end tests that actually run the real program against a real CloudFlare account to verify functionality.
142142

143143
To run these tests, the following environment variables must be present at the time that `make test` is run:
144144
* `CLOUDFLARE_TOKEN` an API token with the usual `Zone:Zone:Read` and `Zone:DNS:Edit` permissions

README.tpl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ It can also print logs in JSON for consumption by logging tools that process JSO
110110
## Development
111111

112112
### Running Tests
113-
`cloudflare-ddns` has a suite of integration tests that actually run the real program against a real CloudFlare account to verify functionality.
113+
`cloudflare-ddns` has a suite of end-to-end tests that actually run the real program against a real CloudFlare account to verify functionality.
114114

115115
To run these tests, the following environment variables must be present at the time that `make test` is run:
116116
* `CLOUDFLARE_TOKEN` an API token with the usual `Zone:Zone:Read` and `Zone:DNS:Edit` permissions

main_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/stretchr/testify/suite"
1818
)
1919

20-
type IntegrationSuite struct {
20+
type EndToEndSuite struct {
2121
suite.Suite
2222
Token string
2323
ZoneID string
@@ -27,22 +27,22 @@ type IntegrationSuite struct {
2727
TestBinary string
2828
}
2929

30-
func TestIntegrationSuite(t *testing.T) {
30+
func TestEndToEndSuite(t *testing.T) {
3131
rand.Seed(time.Now().UnixNano())
32-
suite.Run(t, new(IntegrationSuite))
32+
suite.Run(t, new(EndToEndSuite))
3333
}
3434

35-
func (s *IntegrationSuite) SetupSuite() {
35+
func (s *EndToEndSuite) SetupSuite() {
3636
require := s.Require()
3737
var err error
3838
s.TestBinary = os.Getenv("TEST_BINARY")
39-
require.NotEmpty(s.TestBinary, "Integration tests require compiled binary of cloudflare-ddns at path specified by TEST_BINARY")
39+
require.NotEmpty(s.TestBinary, "End-to-end tests require compiled binary of cloudflare-ddns at path specified by TEST_BINARY")
4040

4141
s.Token = os.Getenv("CLOUDFLARE_TOKEN")
42-
require.NotEmpty(s.Token, "Integration tests require an API token specified by the CLOUDFLARE_TOKEN env var")
42+
require.NotEmpty(s.Token, "End-to-end tests require an API token specified by the CLOUDFLARE_TOKEN env var")
4343

4444
s.Domain = os.Getenv("TEST_DOMAIN")
45-
require.NotEmpty(s.Domain, "Integration tests require a domain specified by the TEST_DOMAIN env var")
45+
require.NotEmpty(s.Domain, "End-to-end tests require a domain specified by the TEST_DOMAIN env var")
4646

4747
s.IP, err = ip.GetPublicIP()
4848
require.NoError(err, "unable to get public IP for tests")
@@ -60,7 +60,7 @@ func (s *IntegrationSuite) SetupSuite() {
6060
require.NoErrorf(err, "Failed to get zone ID, error: %+v", err)
6161
}
6262

63-
func (s *IntegrationSuite) TestWithConfigFile() {
63+
func (s *EndToEndSuite) TestWithConfigFile() {
6464
assert := s.Assert()
6565
require := s.Require()
6666

@@ -82,7 +82,7 @@ func (s *IntegrationSuite) TestWithConfigFile() {
8282
assert.True(s.ipMatches(record), "Expected IP to have been updated")
8383
}
8484

85-
func (s *IntegrationSuite) TestWithArguments() {
85+
func (s *EndToEndSuite) TestWithArguments() {
8686
assert := s.Assert()
8787
require := s.Require()
8888

@@ -95,7 +95,7 @@ func (s *IntegrationSuite) TestWithArguments() {
9595
assert.True(s.ipMatches(record), "Expected IP to have been updated")
9696
}
9797

98-
func (s *IntegrationSuite) TestExistingRecord() {
98+
func (s *EndToEndSuite) TestExistingRecord() {
9999
assert := s.Assert()
100100
require := s.Require()
101101

@@ -108,7 +108,7 @@ func (s *IntegrationSuite) TestExistingRecord() {
108108
assert.True(s.ipMatches(record), "Expected IP to have been updated")
109109
}
110110

111-
func (s *IntegrationSuite) TestWithEnvVars() {
111+
func (s *EndToEndSuite) TestWithEnvVars() {
112112
assert := s.Assert()
113113
require := s.Require()
114114

@@ -121,21 +121,21 @@ func (s *IntegrationSuite) TestWithEnvVars() {
121121
assert.True(s.ipMatches(record), "Expected IP to have been updated")
122122
}
123123

124-
func (s *IntegrationSuite) deleteRecord(record string) {
124+
func (s *EndToEndSuite) deleteRecord(record string) {
125125
r, err := s.getDNSRecordByName(record)
126126
s.Assert().NoErrorf(err, "Could not find DNS record of name '%s' in zone ID '%s', cannot clean up", record, s.ZoneID)
127127
err = s.CF.DeleteDNSRecord(s.ZoneID, r.ID)
128128
s.Assert().NoErrorf(err, "Failed to remove DNS record of name '%s' in zone ID '%s'", record, s.ZoneID)
129129
}
130130

131-
func (s *IntegrationSuite) ipMatches(record string) bool {
131+
func (s *EndToEndSuite) ipMatches(record string) bool {
132132
r, err := s.getDNSRecordByName(record)
133133
s.Require().NotNilf(r, "Expected record for '%s' to be not nil", record)
134134
s.Require().NoError(err, "Failed to get record ID of '%s'", record)
135135
return r.Content == s.IP
136136
}
137137

138-
func (s *IntegrationSuite) getDNSRecordByName(record string) (*cloudflare.DNSRecord, error) {
138+
func (s *EndToEndSuite) getDNSRecordByName(record string) (*cloudflare.DNSRecord, error) {
139139
records, err := s.CF.DNSRecords(s.ZoneID, cloudflare.DNSRecord{Type: "A"})
140140
if err != nil {
141141
return nil, errors.Trace(err)
@@ -148,7 +148,7 @@ func (s *IntegrationSuite) getDNSRecordByName(record string) (*cloudflare.DNSRec
148148
return nil, errors.NotFoundf("no record '%s' found in zone ID '%s'", record, s.ZoneID)
149149
}
150150

151-
func (s *IntegrationSuite) createRandomDNSRecord(ip string) string {
151+
func (s *EndToEndSuite) createRandomDNSRecord(ip string) string {
152152
record := s.randomDNSRecord()
153153
_, err := s.CF.CreateDNSRecord(s.ZoneID, cloudflare.DNSRecord{
154154
Content: ip,
@@ -159,11 +159,11 @@ func (s *IntegrationSuite) createRandomDNSRecord(ip string) string {
159159
return record
160160
}
161161

162-
func (s *IntegrationSuite) randomDNSRecord() string {
163-
return fmt.Sprintf("ddns-integration-test-%d.%s", rand.Intn(999999)+100000, s.Domain)
162+
func (s *EndToEndSuite) randomDNSRecord() string {
163+
return fmt.Sprintf("ddns-e2e-test-%d.%s", rand.Intn(999999)+100000, s.Domain)
164164
}
165165

166-
func (s *IntegrationSuite) runProgram(envVars []string, args ...string) (string, error) {
166+
func (s *EndToEndSuite) runProgram(envVars []string, args ...string) (string, error) {
167167
cmd := exec.Command(s.TestBinary, args...)
168168
cmd.Env = envVars
169169
out, err := cmd.CombinedOutput()

0 commit comments

Comments
 (0)