Skip to content

Commit

Permalink
AWS_EC2_METADATA_DISABLED took 2 hours to find
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Nov 22, 2021
1 parent e63e541 commit 72af4f1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/s3test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ def test_writeread(self):
class TestS3PyArrow(unittest.TestCase):
@classmethod
def setUpClass(cls):
# why is this so slow?
cls.s3 = fs.S3FileSystem(region="", endpoint_override="127.0.0.1:3000", scheme="http", anonymous=True)
# this prevents stupid requests to 169.254.169.254 which take a while
os.environ["AWS_EC2_METADATA_DISABLED"] = "true"
cls.s3 = fs.S3FileSystem(endpoint_override="127.0.0.1:3000", scheme="http", anonymous=True)

def get_fresh_key(self):
return "bucket/swag-" + binascii.hexlify(os.urandom(10)).decode('utf-8')
Expand Down Expand Up @@ -74,7 +75,7 @@ def test_deletefile(self):

# this needs multipart uploads to work
def test_largerw(self):
tbl = pa.table([pa.array(range(5000000)), pa.array(range(5000000))], ['a', 'b'])
tbl = pa.table([pa.array(range(2000000)), pa.array(range(2000000))], ['a', 'b'])

key = self.get_fresh_key()
pq.write_table(tbl, key, filesystem=self.s3)
Expand Down

0 comments on commit 72af4f1

Please sign in to comment.