Skip to content

Commit

Permalink
Fix flaky Org IDEConfig tests
Browse files Browse the repository at this point in the history
Summary: These tests have been flaky 3% of the time. After some investigation, it looks like there is some difference between using `Queryx` and `Exec` and when transactions are committed.

Test Plan: ran test 1000 times

Reviewers: philkuz, vihang

Reviewed By: philkuz, vihang

JIRA Issues: PC-1272

Signed-off-by: Michelle Nguyen <michellenguyen@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D10189

GitOrigin-RevId: 7dfd488
  • Loading branch information
aimichelle authored and copybaranaut committed Nov 16, 2021
1 parent c8743e0 commit 9e162fa
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/cloud/profile/datastore/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,22 +539,20 @@ type IDEConfig struct {
// AddIDEConfig adds the IDE config to the org.
func (d *Datastore) AddIDEConfig(orgID uuid.UUID, config *IDEConfig) error {
query := `INSERT INTO org_ide_configs (org_id, ide_name, path) VALUES ($1, $2, $3)`
rows, err := d.db.Queryx(query, orgID, config.Name, config.Path)
_, err := d.db.Exec(query, orgID, config.Name, config.Path)
if err != nil {
return err
}
rows.Close()
return nil
}

// DeleteIDEConfig deletes the IDE config from the org.
func (d *Datastore) DeleteIDEConfig(orgID uuid.UUID, name string) error {
query := `DELETE FROM org_ide_configs WHERE org_id=$1 AND ide_name=$2`
rows, err := d.db.Queryx(query, orgID, name)
_, err := d.db.Exec(query, orgID, name)
if err != nil {
return err
}
rows.Close()
return nil
}

Expand Down

0 comments on commit 9e162fa

Please sign in to comment.