Skip to content

Commit

Permalink
fix: add a timestamp to the telegraf label creation to insure uniqueness
Browse files Browse the repository at this point in the history
  • Loading branch information
hoorayimhelping committed Dec 11, 2019
1 parent 8729cd0 commit c369113
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
24 changes: 24 additions & 0 deletions ui/cypress/e2e/collectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,30 @@ describe('Collectors', () => {
})
})
})

// fix for https://github.com/influxdata/influxdb/issues/15730
it('creates a cofiguration with a unique label', () => {
cy.contains('Create Configuration').click()

cy.contains('Docker').click()

cy.contains('Continue').click()

cy.contains('docker').click()

cy.get('[name="endpoint"]').type('http://localhost')

cy.contains('Done').click()
cy.get('input[title="Telegraf Configuration Name"]').type('Label 1')
cy.get('input[title="Telegraf Configuration Description"]').type(
'Description 1'
)

cy.contains('Create and Verify').click()

cy.contains('Your configurations have been saved')
})

describe('Label creation and searching', () => {
beforeEach(() => {
const description = 'Config Description'
Expand Down
3 changes: 2 additions & 1 deletion ui/src/dataLoaders/actions/dataLoaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,11 @@ const createTelegraf = async (dispatch, getState, plugins) => {

const createdLabel = await client.labels.create({
orgID: org.id,
name: '@influxdata.token',
name: `@influxdata.token-${new Date().getTime()}`,
properties,
})

console.log('label', createdLabel)
// add label to telegraf config
const label = await client.telegrafConfigs.addLabel(tc.id, createdLabel)

Expand Down
2 changes: 1 addition & 1 deletion ui/src/shared/constants/fluxFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ export const FLUX_FUNCTIONS: FluxToolbarFunction[] = [
name: 'timeout',
desc: 'Timeout for the GET request. Default is `30s`.',
type: 'Duration',
}
},
],
package: 'experimental/http',
desc:
Expand Down

0 comments on commit c369113

Please sign in to comment.