Coder Social home page Coder Social logo

Comments (3)

taoj-action avatar taoj-action commented on August 22, 2024

You might want to do the following in the test:

func TestWorker(t *testing.T) {
os.Setenv("AWS_ACCESS_KEY_ID", "your aws access key id")
os.Setenv("AWS_SECRET_ACCESS_KEY", "your aws secret access key")
defer os.Unsetenv("AWS_ACCESS_KEY_ID")
defer os.Unsetenv("AWS_SECRET_ACCESS_KEY")

kclConfig := cfg.NewKinesisClientLibConfig("appName", streamName, regionName, workerID).
	WithInitialPositionInStream(cfg.LATEST).
	WithMaxRecords(40).
	WithMaxLeasesForWorker(1).
	WithShardSyncIntervalMillis(5000)

hmake test runs inside a docker contain and it may not be able to access the credentials under ~/.aws

from vmware-go-kcl.

aaron-sua avatar aaron-sua commented on August 22, 2024

actually I modified the hmake file to pass the env vars which worked. But leaving hard coded credentials isn't great. I ended up using the volumes declaration.

volumes:
    - '~/.aws:/root/.aws:ro'

However ~ doesn't always expand on the various environments this needs to run in.
Unfortunately hmake doesn't have a good way to pass variables at runtime it seems.
So I've used a .hmakerc file with the settings override.

volumes:
    - 'Users/myLocalUser/.aws:/root/.aws:ro'

HyperMake is interesting but most of the time I use Ansible for this sort of thing as it provides a lot more flexibility across environments and keeps everything unified.

from vmware-go-kcl.

taoj-action avatar taoj-action commented on August 22, 2024

Thanks for the suggestion. Actually, the other alternative is to directly run test in IDE. I am using GoLand.
https://www.jetbrains.com/go/

from vmware-go-kcl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.