+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,18 @@ jobs:
run: |
make

- name: Create coverage directory
run: |
mkdir coverage

- name: Run tests
run: go test -v --race -covermode=atomic -coverprofile cover.out ./...
run: go test -v --race -covermode=atomic -coverprofile coverage/cover.txt ./...

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/
name: codecov-umbrella
verbose: true

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Cocos AI

[![codecov](https://codecov.io/gh/ultravioletrs/cocos/graph/badge.svg?token=HX01LR01K9)](https://codecov.io/gh/ultravioletrs/cocos)
![Go report card](https://goreportcard.com/badge/github.com/ultravioletrs/cocos)

[Cocos AI (Confdential Computing System for AI/ML)][cocos] is a platform for secure multiparty computation (SMPC)
based on the [Confidential Computing][cc] and [Trusted Execution Environments (TEEs)][tee].

Expand Down
28 changes: 17 additions & 11 deletions agent/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"fmt"
"testing"
"time"

mglog "github.com/absmach/magistrala/logger"
)
Expand Down Expand Up @@ -39,34 +40,39 @@ func TestStateMachineTransitions(t *testing.T) {
t.Run(fmt.Sprintf("Transition from %v to %v", tc.fromState, tc.expected), func(t *testing.T) {
sm := NewStateMachine(mglog.NewMock(), tc.cmp)
ctx, cancel := context.WithCancel(context.Background())
go func() {
sm.Start(ctx)
}()
sm.wg.Wait()
sm.SetState(tc.fromState)
defer cancel()

go sm.Start(ctx)

time.Sleep(50 * time.Millisecond)

sm.SetState(tc.fromState)
sm.SendEvent(tc.event)

time.Sleep(50 * time.Millisecond)

if sm.GetState() != tc.expected {
t.Errorf("Expected state %v after the event, but got %v", tc.expected, sm.GetState())
}
close(sm.EventChan)
cancel()
})
}
}

func TestStateMachineInvalidTransition(t *testing.T) {
sm := NewStateMachine(mglog.NewMock(), cmp)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

go sm.Start(ctx)

sm.SetState(Idle)
time.Sleep(50 * time.Millisecond)

sm.SetState(Idle)
sm.SendEvent(dataReceived)

if sm.State != Idle {
t.Errorf("State should not change on an invalid event, but got %v", sm.State)
time.Sleep(50 * time.Millisecond)

if sm.GetState() != Idle {
t.Errorf("State should not change on an invalid event, but got %v", sm.GetState())
}
cancel()
}
2 changes: 1 addition & 1 deletion test/computations/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
var _ managergrpc.Service = (*svc)(nil)

const (
svcName = "manager_test_server"
svcName = "computations_test_server"
defaultPort = "7001"
)

Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载