From 9e162fa99740305defb9e1a36bfec5058c164201 Mon Sep 17 00:00:00 2001 From: Michelle Nguyen Date: Tue, 16 Nov 2021 09:09:45 -0800 Subject: [PATCH] Fix flaky Org IDEConfig tests 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 Differential Revision: https://phab.corp.pixielabs.ai/D10189 GitOrigin-RevId: 7dfd4887562e638b4b1ee1c45d230c1b72d81009 --- src/cloud/profile/datastore/datastore.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cloud/profile/datastore/datastore.go b/src/cloud/profile/datastore/datastore.go index 8f6a30fd31a..f061cc3d875 100644 --- a/src/cloud/profile/datastore/datastore.go +++ b/src/cloud/profile/datastore/datastore.go @@ -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 }